add w2ui lib
This commit is contained in:
parent
a1be0791a0
commit
7bfeeb578f
18 changed files with 76297 additions and 96 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
|||
*.psd
|
||||
*.pdf
|
||||
|
|
1691
css/water.css
Normal file
1691
css/water.css
Normal file
File diff suppressed because it is too large
Load diff
22
index.html
22
index.html
|
@ -5,19 +5,21 @@
|
|||
<meta charset="utf-8" />
|
||||
|
||||
<title>fateforge-tools</title>
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/water.css@2/out/water.css" />
|
||||
<link rel="stylesheet" href="css/water.css" />
|
||||
<link href="css/all.min.css" rel="stylesheet" />
|
||||
<link rel="icon" type="image/x-icon" href="/img/FateforgeTool_logo_80.png">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<button onclick="changeLangEN()">English</button>
|
||||
<button onclick="changeLangFR()">French</button>
|
||||
<header>
|
||||
<button onclick="changeLangEN()">English</button>
|
||||
<button onclick="changeLangFR()">French</button>
|
||||
|
||||
<h1>FateforgeTools</h1>
|
||||
<div data-localize="desc">
|
||||
A suite of tools for Fateforge players and Masters.
|
||||
</div>
|
||||
<a href="index.html"><h1>FateforgeTools</h1></a>
|
||||
<div data-localize="desc">
|
||||
A suite of tools for Fateforge players and Masters.
|
||||
</div>
|
||||
</header>
|
||||
<br>
|
||||
<div class="tools">
|
||||
<button onclick="window.location.href='spells.html';">
|
||||
|
@ -54,8 +56,10 @@
|
|||
vertical-align: text-bottom;
|
||||
" src="https://mirrors.creativecommons.org/presskit/icons/nc.svg?ref=chooser-v1" /></a>
|
||||
</p>
|
||||
<div class="CUVD" > <p data-localize="CUVD">CUVD
|
||||
<p data-localize="link"></a></div>
|
||||
<div class="CUVD">
|
||||
<p data-localize="CUVD">CUVD
|
||||
<p data-localize="link"></a>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script type="text/javascript" src="lib/jquery.min.js"></script>
|
||||
|
|
83
js/spells.js
83
js/spells.js
|
@ -1,29 +1,66 @@
|
|||
var normaliseLang;
|
||||
normaliseLang = function (lang) {
|
||||
lang = lang.replace(/_/, "-").toLowerCase();
|
||||
if (lang.length > 3) {
|
||||
lang = lang.substring(0, 3) + lang.substring(3).toUpperCase();
|
||||
}
|
||||
return lang;
|
||||
};
|
||||
// Get the spell json based on choosen language defaultLanguage
|
||||
|
||||
$.defaultLanguage = normaliseLang(
|
||||
navigator.languages && navigator.languages.length > 0
|
||||
? navigator.languages[0]
|
||||
: navigator.language || navigator.userLanguage
|
||||
var jsonsource = "".concat(
|
||||
"../data/spells/spells-grimoire-",
|
||||
$.defaultLanguage.slice(0, 2),
|
||||
".json"
|
||||
);
|
||||
var lang = normaliseLang( $.defaultLanguage);
|
||||
var test;
|
||||
// Fetch data from server
|
||||
fetch(jsonsource)
|
||||
.then((response) => response.json())
|
||||
.then((data) => {
|
||||
// load fetched data into grid
|
||||
test = data.spell;
|
||||
console.log(test);
|
||||
|
||||
fetch('data/spells/spells-grimoire-fr.json')
|
||||
.then((response) => response.json())
|
||||
.then((json) => JSON.parse(json));
|
||||
//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)
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
var string jsonsource = ''.concat("../data/spells/spells-grimoire-",navigator.languages[0].slice(0,2),".json");
|
||||
window.multi = function(el) {
|
||||
grid.multiSelect = el.checked
|
||||
grid.selectNone()
|
||||
grid.refresh()
|
||||
}
|
||||
|
||||
import data from jsonsource assert { type: 'json' };
|
||||
console.log(data);
|
||||
|
||||
var yourHtml = JSON;
|
||||
|
||||
document.getElementById("spell-list").innerHTML = yourHtml;
|
||||
window.selColumn = function(flag) {
|
||||
grid.show.selectColumn = flag
|
||||
grid.refresh()
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
/*
|
||||
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.
|
||||
|
@ -7,18 +6,39 @@ http://github.com/coderifous/jquery-localize
|
|||
Based off of Keith Wood's Localisation jQuery plugin.
|
||||
http://keith-wood.name/localisation.html
|
||||
*/
|
||||
(function($) {
|
||||
(function ($) {
|
||||
var normaliseLang;
|
||||
normaliseLang = function(lang) {
|
||||
lang = lang.replace(/_/, '-').toLowerCase();
|
||||
normaliseLang = function (lang) {
|
||||
lang = lang.replace(/_/, "-").toLowerCase();
|
||||
if (lang.length > 3) {
|
||||
lang = lang.substring(0, 3) + lang.substring(3).toUpperCase();
|
||||
}
|
||||
return lang;
|
||||
};
|
||||
$.defaultLanguage = normaliseLang(navigator.languages && navigator.languages.length > 0 ? navigator.languages[0] : navigator.language || navigator.userLanguage);
|
||||
$.localize = function(pkg, options) {
|
||||
var defaultCallback, deferred, fileExtension, intermediateLangData, jsonCall, lang, loadLanguage, localizeElement, localizeForSpecialKeys, localizeImageElement, localizeInputElement, localizeOptgroupElement, notifyDelegateLanguageLoaded, regexify, setAttrFromValueForKey, setTextFromValueForKey, valueForKey, wrappedSet;
|
||||
$.defaultLanguage = normaliseLang(
|
||||
navigator.languages && navigator.languages.length > 0
|
||||
? navigator.languages[0]
|
||||
: navigator.language || navigator.userLanguage
|
||||
);
|
||||
$.localize = function (pkg, options) {
|
||||
var defaultCallback,
|
||||
deferred,
|
||||
fileExtension,
|
||||
intermediateLangData,
|
||||
jsonCall,
|
||||
lang,
|
||||
loadLanguage,
|
||||
localizeElement,
|
||||
localizeForSpecialKeys,
|
||||
localizeImageElement,
|
||||
localizeInputElement,
|
||||
localizeOptgroupElement,
|
||||
notifyDelegateLanguageLoaded,
|
||||
regexify,
|
||||
setAttrFromValueForKey,
|
||||
setTextFromValueForKey,
|
||||
valueForKey,
|
||||
wrappedSet;
|
||||
if (options == null) {
|
||||
options = {};
|
||||
}
|
||||
|
@ -26,7 +46,7 @@ http://keith-wood.name/localisation.html
|
|||
intermediateLangData = {};
|
||||
fileExtension = options.fileExtension || "json";
|
||||
deferred = $.Deferred();
|
||||
loadLanguage = function(pkg, lang, level) {
|
||||
loadLanguage = function (pkg, lang, level) {
|
||||
var file;
|
||||
if (level == null) {
|
||||
level = 1;
|
||||
|
@ -42,27 +62,33 @@ http://keith-wood.name/localisation.html
|
|||
}
|
||||
break;
|
||||
case 2:
|
||||
file = "" + pkg + "-" + (lang.split('-')[0]) + "." + fileExtension;
|
||||
file = "" + pkg + "-" + lang.split("-")[0] + "." + fileExtension;
|
||||
return jsonCall(file, pkg, lang, level);
|
||||
case 3:
|
||||
file = "" + pkg + "-" + (lang.split('-').slice(0, 2).join('-')) + "." + fileExtension;
|
||||
file =
|
||||
"" +
|
||||
pkg +
|
||||
"-" +
|
||||
lang.split("-").slice(0, 2).join("-") +
|
||||
"." +
|
||||
fileExtension;
|
||||
return jsonCall(file, pkg, lang, level);
|
||||
default:
|
||||
return deferred.resolve();
|
||||
}
|
||||
};
|
||||
jsonCall = function(file, pkg, lang, level) {
|
||||
jsonCall = function (file, pkg, lang, level) {
|
||||
var ajaxOptions, errorFunc, successFunc;
|
||||
if (options.pathPrefix != null) {
|
||||
file = "" + options.pathPrefix + "/" + file;
|
||||
}
|
||||
successFunc = function(d) {
|
||||
successFunc = function (d) {
|
||||
$.extend(intermediateLangData, d);
|
||||
notifyDelegateLanguageLoaded(intermediateLangData);
|
||||
return loadLanguage(pkg, lang, level + 1);
|
||||
};
|
||||
errorFunc = function() {
|
||||
if (level === 2 && lang.indexOf('-') > -1) {
|
||||
errorFunc = function () {
|
||||
if (level === 2 && lang.indexOf("-") > -1) {
|
||||
return loadLanguage(pkg, lang, level + 1);
|
||||
} else if (options.fallback && options.fallback !== lang) {
|
||||
return loadLanguage(pkg, options.fallback);
|
||||
|
@ -74,25 +100,25 @@ http://keith-wood.name/localisation.html
|
|||
async: true,
|
||||
timeout: options.timeout != null ? options.timeout : 500,
|
||||
success: successFunc,
|
||||
error: errorFunc
|
||||
error: errorFunc,
|
||||
};
|
||||
if (window.location.protocol === "file:") {
|
||||
ajaxOptions.error = function(xhr) {
|
||||
ajaxOptions.error = function (xhr) {
|
||||
return successFunc($.parseJSON(xhr.responseText));
|
||||
};
|
||||
}
|
||||
return $.ajax(ajaxOptions);
|
||||
};
|
||||
notifyDelegateLanguageLoaded = function(data) {
|
||||
notifyDelegateLanguageLoaded = function (data) {
|
||||
if (options.callback != null) {
|
||||
return options.callback(data, defaultCallback);
|
||||
} else {
|
||||
return defaultCallback(data);
|
||||
}
|
||||
};
|
||||
defaultCallback = function(data) {
|
||||
defaultCallback = function (data) {
|
||||
$.localize.data[pkg] = data;
|
||||
return wrappedSet.each(function() {
|
||||
return wrappedSet.each(function () {
|
||||
var elem, key, value;
|
||||
elem = $(this);
|
||||
key = elem.data("localize");
|
||||
|
@ -103,14 +129,14 @@ http://keith-wood.name/localisation.html
|
|||
}
|
||||
});
|
||||
};
|
||||
localizeElement = function(elem, key, value) {
|
||||
if (elem.is('input')) {
|
||||
localizeElement = function (elem, key, value) {
|
||||
if (elem.is("input")) {
|
||||
localizeInputElement(elem, key, value);
|
||||
} else if (elem.is('textarea')) {
|
||||
} else if (elem.is("textarea")) {
|
||||
localizeInputElement(elem, key, value);
|
||||
} else if (elem.is('img')) {
|
||||
} else if (elem.is("img")) {
|
||||
localizeImageElement(elem, key, value);
|
||||
} else if (elem.is('optgroup')) {
|
||||
} else if (elem.is("optgroup")) {
|
||||
localizeOptgroupElement(elem, key, value);
|
||||
} else if (!$.isPlainObject(value)) {
|
||||
elem.html(value);
|
||||
|
@ -119,7 +145,7 @@ http://keith-wood.name/localisation.html
|
|||
return localizeForSpecialKeys(elem, value);
|
||||
}
|
||||
};
|
||||
localizeInputElement = function(elem, key, value) {
|
||||
localizeInputElement = function (elem, key, value) {
|
||||
var val;
|
||||
val = $.isPlainObject(value) ? value.value : value;
|
||||
if (elem.is("[placeholder]")) {
|
||||
|
@ -128,19 +154,19 @@ http://keith-wood.name/localisation.html
|
|||
return elem.val(val);
|
||||
}
|
||||
};
|
||||
localizeForSpecialKeys = function(elem, value) {
|
||||
localizeForSpecialKeys = function (elem, value) {
|
||||
setAttrFromValueForKey(elem, "title", value);
|
||||
setAttrFromValueForKey(elem, "href", value);
|
||||
return setTextFromValueForKey(elem, "text", value);
|
||||
};
|
||||
localizeOptgroupElement = function(elem, key, value) {
|
||||
localizeOptgroupElement = function (elem, key, value) {
|
||||
return elem.attr("label", value);
|
||||
};
|
||||
localizeImageElement = function(elem, key, value) {
|
||||
localizeImageElement = function (elem, key, value) {
|
||||
setAttrFromValueForKey(elem, "alt", value);
|
||||
return setAttrFromValueForKey(elem, "src", value);
|
||||
};
|
||||
valueForKey = function(key, data) {
|
||||
valueForKey = function (key, data) {
|
||||
var keys, value, _i, _len;
|
||||
keys = key.split(/\./);
|
||||
value = data;
|
||||
|
@ -150,37 +176,43 @@ http://keith-wood.name/localisation.html
|
|||
}
|
||||
return value;
|
||||
};
|
||||
setAttrFromValueForKey = function(elem, key, value) {
|
||||
setAttrFromValueForKey = function (elem, key, value) {
|
||||
value = valueForKey(key, value);
|
||||
if (value != null) {
|
||||
return elem.attr(key, value);
|
||||
}
|
||||
};
|
||||
setTextFromValueForKey = function(elem, key, value) {
|
||||
setTextFromValueForKey = function (elem, key, value) {
|
||||
value = valueForKey(key, value);
|
||||
if (value != null) {
|
||||
return elem.text(value);
|
||||
}
|
||||
};
|
||||
regexify = function(string_or_regex_or_array) {
|
||||
regexify = function (string_or_regex_or_array) {
|
||||
var thing;
|
||||
if (typeof string_or_regex_or_array === "string") {
|
||||
return "^" + string_or_regex_or_array + "$";
|
||||
} else if (string_or_regex_or_array.length != null) {
|
||||
return ((function() {
|
||||
return (function () {
|
||||
var _i, _len, _results;
|
||||
_results = [];
|
||||
for (_i = 0, _len = string_or_regex_or_array.length; _i < _len; _i++) {
|
||||
for (
|
||||
_i = 0, _len = string_or_regex_or_array.length;
|
||||
_i < _len;
|
||||
_i++
|
||||
) {
|
||||
thing = string_or_regex_or_array[_i];
|
||||
_results.push(regexify(thing));
|
||||
}
|
||||
return _results;
|
||||
})()).join("|");
|
||||
})().join("|");
|
||||
} else {
|
||||
return string_or_regex_or_array;
|
||||
}
|
||||
};
|
||||
lang = normaliseLang(options.language ? options.language : $.defaultLanguage);
|
||||
lang = normaliseLang(
|
||||
options.language ? options.language : $.defaultLanguage
|
||||
);
|
||||
if (options.skipLanguage && lang.match(regexify(options.skipLanguage))) {
|
||||
deferred.resolve();
|
||||
} else {
|
||||
|
@ -190,5 +222,5 @@ http://keith-wood.name/localisation.html
|
|||
return wrappedSet;
|
||||
};
|
||||
$.fn.localize = $.localize;
|
||||
return $.localize.data = {};
|
||||
return ($.localize.data = {});
|
||||
})(jQuery);
|
||||
|
|
3720
lib/w2ui/w2ui-1.5.css
Normal file
3720
lib/w2ui/w2ui-1.5.css
Normal file
File diff suppressed because one or more lines are too long
21501
lib/w2ui/w2ui-1.5.js
Normal file
21501
lib/w2ui/w2ui-1.5.js
Normal file
File diff suppressed because it is too large
Load diff
1
lib/w2ui/w2ui-1.5.js.map
Normal file
1
lib/w2ui/w2ui-1.5.js.map
Normal file
File diff suppressed because one or more lines are too long
2
lib/w2ui/w2ui-1.5.min.css
vendored
Normal file
2
lib/w2ui/w2ui-1.5.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
2
lib/w2ui/w2ui-1.5.min.js
vendored
Normal file
2
lib/w2ui/w2ui-1.5.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
3714
lib/w2ui/w2ui.css
Normal file
3714
lib/w2ui/w2ui.css
Normal file
File diff suppressed because one or more lines are too long
22158
lib/w2ui/w2ui.es6.js
Normal file
22158
lib/w2ui/w2ui.es6.js
Normal file
File diff suppressed because it is too large
Load diff
486
lib/w2ui/w2ui.es6.min.js
vendored
Normal file
486
lib/w2ui/w2ui.es6.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
22349
lib/w2ui/w2ui.js
Normal file
22349
lib/w2ui/w2ui.js
Normal file
File diff suppressed because it is too large
Load diff
2
lib/w2ui/w2ui.min.css
vendored
Normal file
2
lib/w2ui/w2ui.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
486
lib/w2ui/w2ui.min.js
vendored
Normal file
486
lib/w2ui/w2ui.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
69
spells.html
69
spells.html
|
@ -5,52 +5,67 @@
|
|||
<meta charset="utf-8" />
|
||||
|
||||
<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/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">
|
||||
|
||||
|
||||
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<button onclick="changeLangEN()">English</button>
|
||||
<button onclick="changeLangFR()">French</button>
|
||||
<header>
|
||||
<button onclick="changeLangEN()">English</button>
|
||||
<button onclick="changeLangFR()">French</button>
|
||||
|
||||
<h1>FateforgeTools</h1>
|
||||
<a href="index.html">
|
||||
<h1>FateforgeTools</h1>
|
||||
</a>
|
||||
</header>
|
||||
<h2 data-localize="btn-spells">Spells</h2>
|
||||
|
||||
<div class="container" style="display: flex;">
|
||||
<!--<div class="container" style="display: flex;flex-direction: row;flex-wrap: wrap;">-->
|
||||
|
||||
<div class="view-col" id="list">
|
||||
<div id="sublistcontainer" class="sublist sublist--resizable">
|
||||
<div id="sublistsort" class="btn-group">
|
||||
<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 id="container" style="width: 100%; ">
|
||||
<div style="display: flex; flex-direction: row;flex-wrap: wrap;">
|
||||
<div id="spell-list" style="min-width: 300px;max-width:900px;height: 300px;"">
|
||||
<!-- FILL WITH JS-->
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<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>
|
||||
</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>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<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="js/language.js"></script>
|
||||
<script type="text/javascript" src="lib/w2ui/w2ui.js"></script>
|
||||
|
||||
|
||||
|
||||
<script type="module" src="js/spells.js"></script>
|
||||
|
||||
|
||||
<script src="https://kit.fontawesome.com/126cdd0e29.js" crossorigin="anonymous"></script>
|
||||
</body>
|
||||
|
||||
|
|
Loading…
Reference in a new issue