mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Fixed l10n and import scripts failing.
The l10n script was failing because the location of the pluginLI template had changed. The import scripts were failing because their importDoc JS var was getting overwritten by the other script. Localised text has also been added back into message dialogs.
This commit is contained in:
@@ -23,33 +23,44 @@
|
||||
}
|
||||
.accept, .cancel {
|
||||
margin: 0.5em;
|
||||
font-size: 2em;
|
||||
font-size: 1.5em;
|
||||
display: inline-block;
|
||||
cursor: pointer;
|
||||
}
|
||||
.accept {
|
||||
.accept > span:last-child, .cancel > span:last-child {
|
||||
margin-left: 0.5em;
|
||||
display: inline-block;
|
||||
}
|
||||
.accept:hover {
|
||||
color: green;
|
||||
cursor: pointer;
|
||||
}
|
||||
.cancel {
|
||||
.cancel:hover {
|
||||
color: red;
|
||||
cursor: pointer;
|
||||
}
|
||||
</style>
|
||||
<span class="icon fa fa-exclamation-circle"></span>
|
||||
<h1><content select="h1"></content></h1>
|
||||
<p><content select="p"></content></p>
|
||||
<div class="buttons">
|
||||
<span class="accept fa fa-check"></span>
|
||||
<span class="cancel fa fa-close"></span>
|
||||
<div class="accept"><span class="fa fa-check"></span><span></span></div>
|
||||
<div class="cancel"><span class="fa fa-close"></span><span></span></div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
'use strict';
|
||||
// Record this document.
|
||||
var importDoc = document.currentScript.ownerDocument;
|
||||
var messageDialogImportDoc = document.currentScript.ownerDocument;
|
||||
|
||||
/* Create a <dialog is="message-dialog"> element type. */
|
||||
var messageDialogProto = Object.create(HTMLDialogElement.prototype, {
|
||||
|
||||
setButtonText: {
|
||||
value: function(accept, cancel) {
|
||||
this.shadowRoot.getElementsByClassName('accept')[0].lastChild.textContent = accept;
|
||||
this.shadowRoot.getElementsByClassName('cancel')[0].lastChild.textContent = cancel;
|
||||
}
|
||||
},
|
||||
|
||||
onClose: {
|
||||
value: function(evt) {
|
||||
var ret = evt.target.returnValue == 'true';
|
||||
@@ -90,7 +101,7 @@ var messageDialogProto = Object.create(HTMLDialogElement.prototype, {
|
||||
createdCallback: {
|
||||
value: function() {
|
||||
|
||||
var template = importDoc.querySelector('#messageDialog');
|
||||
var template = messageDialogImportDoc.querySelector('#messageDialog');
|
||||
var clone = document.importNode(template.content, true);
|
||||
var root = this.createShadowRoot();
|
||||
root.appendChild(clone);
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<script>
|
||||
'use strict';
|
||||
// Record this document.
|
||||
var importDoc = document.currentScript.ownerDocument;
|
||||
var pluginLiImportDoc = document.currentScript.ownerDocument;
|
||||
|
||||
/* Create a <li is="plugin-li"> element type. */
|
||||
var pluginLIProto = Object.create(HTMLLIElement.prototype, {
|
||||
@@ -57,7 +57,7 @@ var pluginLIProto = Object.create(HTMLLIElement.prototype, {
|
||||
|
||||
createdCallback: {
|
||||
value: function() {
|
||||
var template = importDoc.querySelector('#pluginLI');
|
||||
var template = pluginLiImportDoc.querySelector('#pluginLI');
|
||||
var clone = document.importNode(template.content, true);
|
||||
var root = this.createShadowRoot();
|
||||
root.appendChild(clone);
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
pluginCard.getElementById('cancel').textContent = l10n.translate("Cancel").fetch();
|
||||
|
||||
/* Plugin List Item Template */
|
||||
var pluginLI = document.getElementById('pluginLI').content;
|
||||
var pluginLI = pluginLiImportDoc.querySelector('#pluginLI').content;
|
||||
pluginLI.querySelector('.dummyPlugin').title = l10n.translate("Dummy Plugin").fetch();
|
||||
pluginLI.querySelector('.loadsBSA').title = l10n.translate("Loads BSA").fetch();
|
||||
pluginLI.querySelector('.hasUserEdits').title = l10n.translate("Has User Metadata").fetch();
|
||||
|
||||
@@ -549,13 +549,17 @@ function applyFilters(evt) {
|
||||
}
|
||||
function showMessageDialog(title, text, closeCallback) {
|
||||
var dialog = new MessageDialog();
|
||||
|
||||
dialog.setButtonText(l10n.jed.translate('Yes').fetch(), l10n.jed.translate('Cancel').fetch());
|
||||
document.body.appendChild(dialog);
|
||||
dialog.showModal('warn', title, text, closeCallback);
|
||||
}
|
||||
function showMessageBox(type, title, text) {
|
||||
var dialog = new MessageDialog();
|
||||
|
||||
if (type == 'error' || type == 'info') {
|
||||
dialog.setButtonText(l10n.jed.translate('OK').fetch(), l10n.jed.translate('Cancel').fetch());
|
||||
} else {
|
||||
dialog.setButtonText(l10n.jed.translate('Yes').fetch(), l10n.jed.translate('Cancel').fetch());
|
||||
}
|
||||
document.body.appendChild(dialog);
|
||||
dialog.showModal(type, title, text);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user