mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
More report work, added polyfills for localStorage, getElementsByClassName, DOM4 events. Untested so far though.
This commit is contained in:
@@ -56,7 +56,6 @@ BOSSv3 won't have a command line interface, to simplify things. It also allows B
|
||||
- [ ] Optimisations to load ordering.
|
||||
- [ ] Implement logging.
|
||||
- [ ] Add a quick header-only plugin read for use when loading the metadata editor, so that existing Bash Tags can also be displayed.
|
||||
- [ ] Add checks for "Deactivate" tag compliance?
|
||||
- [ ] Make validity checks non-fatal.
|
||||
- [ ] Add a massive "RUN THE GAME LAUNCHER IF YOUR GAME IS NOT DETECTED" message somewhere.
|
||||
- [ ] Generalise Total Conversion support, so that any TC for any of the supported 'base' games can be used with BOSS.
|
||||
@@ -65,7 +64,7 @@ BOSSv3 won't have a command line interface, to simplify things. It also allows B
|
||||
- [ ] Write report Javascript.
|
||||
- [ ] Double-check ghosted file support.
|
||||
- [ ] Add a setting that lets users choose whether to use the viewer window or their own browser when viewing BOSS's report.
|
||||
- [ ] Somehow implement filter settings memory for the BOSS report.
|
||||
- [x] Somehow implement filter settings memory for the BOSS report.
|
||||
- [ ] Implement checking of details part of report against previous report.
|
||||
|
||||
|
||||
@@ -110,6 +109,8 @@ BOSS uses the following libraries:
|
||||
* wxWidgets
|
||||
* yaml-cpp
|
||||
|
||||
Also uses (polyfill.js)[https://github.com/inexorabletash/polyfill/blob/master/polyfill.js], (storage.js)[https://github.com/inexorabletash/polyfill/blob/master/storage.js] and (DOM-shim)[https://github.com/Raynos/DOM-shim/blob/master/lib/DOM-shim-ie8.js] for Internet Explorer 8 compatibility.
|
||||
|
||||
|
||||
## Misc
|
||||
|
||||
|
||||
@@ -198,10 +198,7 @@ This documentation is a work in progress, covering an application that is also s
|
||||
<li>The <var>name</var> is the actual Bash Tag name.
|
||||
<li>The <var>condition</var> decides if the Tag is to be suggested or not. It functions as for files and messages.
|
||||
</ul>
|
||||
<p>A few Bash Tags are used by BOSS in its load order error checking:
|
||||
<ul>
|
||||
<li>If an active mod has the <code>Deactivate</code> tag applied (not merely suggested), an error message will be displayed for it.
|
||||
<li>If a plugin's masters are missing, an error message will be displayed for it. Filter patches are special mods designed for use with a Bashed Patch that do not require all their masters to be present, and so any plugin with the <code>Filter</code> tag applied and missing masters will not cause any errors to be displayed.
|
||||
<p>If a plugin's masters are missing, an error message will be displayed for it. Filter patches are special mods designed for use with a Bashed Patch that do not require all their masters to be present, and so any plugin with the <code>Filter</code> tag applied and missing masters will not cause any errors to be displayed.
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,26 +1,34 @@
|
||||
'use strict';
|
||||
// shim for older browsers:
|
||||
if (!document.getElementsByClassName) {
|
||||
document.getElementsByClassName = (function(){
|
||||
// Utility function to traverse the DOM:
|
||||
function traverse (node, callback) {
|
||||
callback(node);
|
||||
for (var i=0;i < node.childNodes.length; i++) {
|
||||
traverse(node.childNodes[i],callback);
|
||||
function isStorageSupported() {
|
||||
try {
|
||||
return ('localStorage' in window && window['localStorage'] !== null && window['localStorage'] !== undefined);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
function saveCheckboxState(evt) {
|
||||
if (evt.currentTarget.checked) {
|
||||
try {
|
||||
localStorage.setItem(evt.currentTarget.id, evt.currentTarget.checked);
|
||||
} catch (e) {
|
||||
if (e == QUOTA_EXCEEDED_ERR) {
|
||||
alert('Web storage quota for this document has been exceeded. Please empty your browser\'s cache. Note that this will delete all locally stored data.');
|
||||
}
|
||||
}
|
||||
|
||||
// Actual definition of getElementsByClassName
|
||||
return function (name) {
|
||||
var result = [];
|
||||
traverse(document.body,function(node){
|
||||
if (node.className && node.className.indexOf(name) != -1) {
|
||||
result.push(node);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
} else {
|
||||
localStorage.removeItem(evt.currentTarget.id);
|
||||
}
|
||||
}
|
||||
function loadSettings() {
|
||||
var i = localStorage.length - 1;
|
||||
while (i > -1) {
|
||||
var elem = document.getElementById(localStorage.key(i));
|
||||
if (elem != null && 'defaultChecked' in elem) {
|
||||
elem.checked = true;
|
||||
elem.dispatchEvent(new MouseEvent('click'));
|
||||
}
|
||||
})()
|
||||
i--;
|
||||
}
|
||||
}
|
||||
function showElement(element) {
|
||||
if (element != null) {
|
||||
@@ -164,6 +172,14 @@ function togglePlugins(evt) {
|
||||
}
|
||||
function setupEventHandlers() {
|
||||
var i, elemArr;
|
||||
if (isStorageSupported()) { /*Set up filter value and CSS setting storage read/write handlers.*/
|
||||
elemArr = document.getElementById('filters').getElementsByTagName('input');
|
||||
i = elemArr.length - 1;
|
||||
while (i > -1) {
|
||||
elemArr[i].addEventListener('click', saveCheckboxState, false);
|
||||
i--;
|
||||
}
|
||||
}
|
||||
document.getElementById('filtersToggle').addEventListener('click', toggleFilters, false);
|
||||
/*Set up handlers for section display.*/
|
||||
elemArr = document.getElementById('nav').querySelectorAll('.button[data-section]');
|
||||
@@ -184,6 +200,9 @@ function setupEventHandlers() {
|
||||
}
|
||||
function init() {
|
||||
setupEventHandlers();
|
||||
if (isStorageSupported()) {
|
||||
loadSettings();
|
||||
}
|
||||
var elemArr = document.getElementById('filters').getElementsByTagName('input');
|
||||
for (var i = 0, z = elemArr.length; i < z; i++) {
|
||||
elemArr[i].disabled = true;
|
||||
@@ -0,0 +1,121 @@
|
||||
// Storage polyfill by Remy Sharp
|
||||
// https://gist.github.com/350433
|
||||
// Needed for IE7-
|
||||
|
||||
// Dependencies:
|
||||
// JSON (use json2.js if necessary)
|
||||
|
||||
// Tweaks by Joshua Bell (inexorabletash@gmail.com)
|
||||
// * URI-encode item keys
|
||||
// * Use String() for stringifying
|
||||
// * added length
|
||||
|
||||
if (!window.localStorage || !window.sessionStorage) (function() {
|
||||
|
||||
var Storage = function(type) {
|
||||
function createCookie(name, value, days) {
|
||||
var date, expires;
|
||||
|
||||
if (days) {
|
||||
date = new Date();
|
||||
date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
|
||||
expires = "; expires=" + date.toGMTString();
|
||||
} else {
|
||||
expires = "";
|
||||
}
|
||||
document.cookie = name + "=" + value + expires + "; path=/";
|
||||
}
|
||||
|
||||
function readCookie(name) {
|
||||
var nameEQ = name + "=",
|
||||
ca = document.cookie.split(';'),
|
||||
i, c;
|
||||
|
||||
for (i = 0; i < ca.length; i++) {
|
||||
c = ca[i];
|
||||
while (c.charAt(0) == ' ') {
|
||||
c = c.substring(1, c.length);
|
||||
}
|
||||
|
||||
if (c.indexOf(nameEQ) == 0) {
|
||||
return c.substring(nameEQ.length, c.length);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function setData(data) {
|
||||
data = JSON.stringify(data);
|
||||
if (type == 'session') {
|
||||
window.name = data;
|
||||
} else {
|
||||
createCookie('localStorage', data, 365);
|
||||
}
|
||||
}
|
||||
|
||||
function clearData() {
|
||||
if (type == 'session') {
|
||||
window.name = '';
|
||||
} else {
|
||||
createCookie('localStorage', '', 365);
|
||||
}
|
||||
}
|
||||
|
||||
function getData() {
|
||||
var data = type == 'session' ? window.name : readCookie('localStorage');
|
||||
return data ? JSON.parse(data) : {};
|
||||
}
|
||||
|
||||
|
||||
// initialise if there's already data
|
||||
var data = getData();
|
||||
|
||||
function numKeys() {
|
||||
var n = 0;
|
||||
for (var k in data) {
|
||||
if (data.hasOwnProperty(k)) {
|
||||
n += 1;
|
||||
}
|
||||
}
|
||||
return n;
|
||||
}
|
||||
|
||||
return {
|
||||
clear: function() {
|
||||
data = {};
|
||||
clearData();
|
||||
this.length = numKeys();
|
||||
},
|
||||
getItem: function(key) {
|
||||
key = encodeURIComponent(key);
|
||||
return data[key] === undefined ? null : data[key];
|
||||
},
|
||||
key: function(i) {
|
||||
// not perfect, but works
|
||||
var ctr = 0;
|
||||
for (var k in data) {
|
||||
if (ctr == i) return decodeURIComponent(k);
|
||||
else ctr++;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
removeItem: function(key) {
|
||||
key = encodeURIComponent(key);
|
||||
delete data[key];
|
||||
setData(data);
|
||||
this.length = numKeys();
|
||||
},
|
||||
setItem: function(key, value) {
|
||||
key = encodeURIComponent(key);
|
||||
data[key] = String(value);
|
||||
setData(data);
|
||||
this.length = numKeys();
|
||||
},
|
||||
length: 0
|
||||
};
|
||||
};
|
||||
|
||||
if (!window.localStorage) window.localStorage = new Storage('local');
|
||||
if (!window.sessionStorage) window.sessionStorage = new Storage('session');
|
||||
|
||||
})();
|
||||
@@ -122,3 +122,52 @@ li {margin:0.75em 0;}
|
||||
.hidden, #summary.hidden, #plugins.hidden {
|
||||
display:none;
|
||||
}
|
||||
|
||||
|
||||
/* Old BOSS Log CSS */
|
||||
|
||||
h1{font-size:3em;margin:0;}
|
||||
|
||||
h2{font-size:2em;margin-top:0;}
|
||||
|
||||
ul{list-style:none;padding-left:0;}
|
||||
|
||||
ul li{margin-left:0;margin-bottom:1em;}
|
||||
|
||||
li ul{margin-top:.5em;padding-left:2.5em;margin-bottom:2em;}
|
||||
|
||||
li.error{background:#ff9090;display:table;padding:0.3em 0.5em;border-radius:0.5em;}
|
||||
|
||||
li.warn{background:#FFDD55;display:table;padding:0.3em 0.5em;border-radius:0.5em;}
|
||||
|
||||
li.success{background:#90ff90;display:table;padding:0.3em 0.5em;border-radius:0.5em;}
|
||||
|
||||
.version{color:#6394F8;margin-right:1em;}
|
||||
|
||||
.crc{color:#BC8923;margin-right:1em;}
|
||||
|
||||
.active{color:#0A0;margin-right:1em;}
|
||||
|
||||
.tagPrefix{color:#CD5555;}
|
||||
|
||||
.dirty{color:#960;}
|
||||
|
||||
.message{color:gray;}
|
||||
|
||||
.mod{margin-right:1em;}
|
||||
|
||||
tr.good td {background: #90ff90;}
|
||||
|
||||
tr.warn td {background: #FFDD55;}
|
||||
|
||||
tr.error td {background:#ff9090;}
|
||||
|
||||
th {text-align:left; padding:1em; background:lightblue;}
|
||||
|
||||
.message {color:#880088;}
|
||||
|
||||
#summary li {border-radius:0.5em;padding:0.5em 1em;display:table;background:#DDD;}
|
||||
|
||||
#summary li.error{background:#ff9090;}
|
||||
|
||||
#summary li.warn{background:#FFDD55;}
|
||||
+13
-3
@@ -114,7 +114,7 @@ namespace boss {
|
||||
node = head.append_child();
|
||||
node.set_name("link");
|
||||
node.append_attribute("rel").set_value("stylesheet");
|
||||
node.append_attribute("href").set_value("../../examples/style.css");
|
||||
node.append_attribute("href").set_value("../resource/style.css");
|
||||
}
|
||||
|
||||
void AppendNav(pugi::xml_node& body) {
|
||||
@@ -458,12 +458,22 @@ namespace boss {
|
||||
|
||||
node = body.append_child();
|
||||
node.set_name("script");
|
||||
node.append_attribute("src").set_value("../../examples/eventShim.js");
|
||||
node.append_attribute("src").set_value("../resource/polyfill.js");
|
||||
node.text().set(" ");
|
||||
|
||||
node = body.append_child();
|
||||
node.set_name("script");
|
||||
node.append_attribute("src").set_value("../../examples/script.js");
|
||||
node.append_attribute("src").set_value("../resource/storage.js");
|
||||
node.text().set(" ");
|
||||
|
||||
node = body.append_child();
|
||||
node.set_name("script");
|
||||
node.append_attribute("src").set_value("../resource/DOM-shim-ie8.js");
|
||||
node.text().set(" ");
|
||||
|
||||
node = body.append_child();
|
||||
node.set_name("script");
|
||||
node.append_attribute("src").set_value("../resource/script.js");
|
||||
node.text().set(" ");
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user