mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Some Vulcanize compatibility changes.
* Changed the ID of the settings dialog to not conflict with Polymer's settings icon's ID when the latter is inlined. * Added alternative template selection for when the imported files they're in are inlined. * Fixed exception when there are no global messages.
This commit is contained in:
@@ -231,7 +231,12 @@ td paper-icon-button.hidden {
|
||||
/* Create new row. */
|
||||
var table = evt.currentTarget.parentElement.parentElement;
|
||||
var rowTemplateId = table.getAttribute('data-template');
|
||||
var content = document.querySelector('link[rel="import"][href$="editable-table.html"]').import.getElementById(rowTemplateId).content;
|
||||
var content = document.querySelector('link[rel="import"][href$="editable-table.html"]');
|
||||
if (content) {
|
||||
content = content.import.getElementById(rowTemplateId).content;
|
||||
} else {
|
||||
content = document.getElementById(rowTemplateId).content;
|
||||
}
|
||||
var rowContent = document.importNode(content, true);
|
||||
|
||||
var row = document.createElement('tr');
|
||||
@@ -247,7 +252,12 @@ td paper-icon-button.hidden {
|
||||
addRow: {
|
||||
value: function(tableData) {
|
||||
var rowTemplateId = this.getAttribute('data-template');
|
||||
var content = document.querySelector('link[rel="import"][href$="editable-table.html"]').import.getElementById(rowTemplateId).content;
|
||||
var content = document.querySelector('link[rel="import"][href$="editable-table.html"]');
|
||||
if (content) {
|
||||
content = content.import.getElementById(rowTemplateId).content;
|
||||
} else {
|
||||
content = document.getElementById(rowTemplateId).content;
|
||||
}
|
||||
var rowContent = document.importNode(content, true);
|
||||
|
||||
var row = document.createElement('tr');
|
||||
|
||||
@@ -51,7 +51,13 @@
|
||||
|
||||
translateStaticText: function(l10n) {
|
||||
/* Plugin card template. */
|
||||
var pluginCard = document.querySelector('link[rel="import"][href$="loot-plugin-card.html"]').import.querySelector('template').content;
|
||||
var pluginCard = document.querySelector('link[rel="import"][href$="loot-plugin-card.html"]');
|
||||
if (pluginCard) {
|
||||
pluginCard = pluginCard.import.querySelector('template').content;
|
||||
} else {
|
||||
pluginCard = document.querySelector('polymer-element[name="loot-plugin-card"]').querySelector('template').content;
|
||||
}
|
||||
|
||||
pluginCard.getElementById('front').querySelector('.activeTick').label = l10n.translate("Active Plugin").fetch();
|
||||
pluginCard.getElementById('editor').querySelector('.activeTick').label = l10n.translate("Active Plugin").fetch();
|
||||
pluginCard.getElementById('front').querySelector('.dummyPlugin').label = l10n.translate("Dummy Plugin").fetch();
|
||||
@@ -119,20 +125,35 @@
|
||||
pluginCard.getElementById('clearMetadata').label = l10n.translate("Clear User Metadata").fetch();
|
||||
|
||||
/* Plugin List Item Template */
|
||||
var pluginItem = document.querySelector('link[rel="import"][href$="loot-plugin-item.html"]').import.querySelector('template').content;
|
||||
var pluginItem = document.querySelector('link[rel="import"][href$="loot-plugin-item.html"]');
|
||||
if (pluginItem) {
|
||||
pluginItem = pluginItem.import.querySelector('template').content;
|
||||
} else {
|
||||
pluginItem = document.querySelector('polymer-element[name="loot-plugin-item"]').querySelector('template').content;
|
||||
}
|
||||
pluginItem.querySelector('#dummyPlugin').label = l10n.translate("Dummy Plugin").fetch();
|
||||
pluginItem.querySelector('#loadsBSA').label = l10n.translate("Loads BSA").fetch();
|
||||
pluginItem.querySelector('#hasUserEdits').label = l10n.translate("Has User Metadata").fetch();
|
||||
pluginItem.querySelector('#hasGlobalPriority').label = l10n.translate("Priority Is Global").fetch();
|
||||
|
||||
/* Message row template */
|
||||
var messageRow = document.querySelector('link[rel="import"][href$="editable-table.html"]').import.querySelector('#messageRow').content;
|
||||
var messageRow = document.querySelector('link[rel="import"][href$="editable-table.html"]');
|
||||
if (messageRow) {
|
||||
messageRow = messageRow.querySelector('#messageRow').content;
|
||||
} else {
|
||||
messageRow = document.querySelector('#messageRow').content;
|
||||
}
|
||||
messageRow.querySelector('.type').children[0].textContent = l10n.translate("Note").fetch();
|
||||
messageRow.querySelector('.type').children[1].textContent = l10n.translate("Warning").fetch();
|
||||
messageRow.querySelector('.type').children[2].textContent = l10n.translate("Error").fetch();
|
||||
|
||||
/* Tag row template */
|
||||
var tagRow = document.querySelector('link[rel="import"][href$="editable-table.html"]').import.querySelector('#tagRow').content;
|
||||
var tagRow = document.querySelector('link[rel="import"][href$="editable-table.html"]');
|
||||
if (tagRow) {
|
||||
tagRow = tagRow.querySelector('#tagRow').content;
|
||||
} else {
|
||||
tagRow = document.querySelector('#tagRow').content;
|
||||
}
|
||||
tagRow.querySelector('.type').children[0].textContent = l10n.translate("Add").fetch();
|
||||
tagRow.querySelector('.type').children[1].textContent = l10n.translate("Remove").fetch();
|
||||
|
||||
@@ -182,7 +203,7 @@
|
||||
document.getElementById('generalMessages').firstElementChild.textContent = l10n.translate("General Messages").fetch();
|
||||
|
||||
/* Settings dialog */
|
||||
document.getElementById('settings').heading = l10n.translate("Settings").fetch();
|
||||
document.getElementById('settingsDialog').heading = l10n.translate("Settings").fetch();
|
||||
|
||||
document.getElementById('defaultGameSelect').previousElementSibling.textContent = l10n.translate("Default Game").fetch();
|
||||
document.getElementById('defaultGameSelect').children[0].label = l10n.translate("Autodetect").fetch();
|
||||
@@ -209,8 +230,8 @@
|
||||
|
||||
document.getElementById('languageRestartTxt').textContent = l10n.translate("Language changes will be applied after LOOT is restarted.").fetch();
|
||||
|
||||
document.getElementById('settings').getElementsByClassName('accept')[0].textContent = l10n.translate("Apply").fetch();
|
||||
document.getElementById('settings').getElementsByClassName('cancel')[0].textContent = l10n.translate("Cancel").fetch();
|
||||
document.getElementById('settingsDialog').getElementsByClassName('accept')[0].textContent = l10n.translate("Apply").fetch();
|
||||
document.getElementById('settingsDialog').getElementsByClassName('cancel')[0].textContent = l10n.translate("Cancel").fetch();
|
||||
|
||||
/* First-run dialog */
|
||||
var firstRun = document.getElementById('firstRun');
|
||||
|
||||
@@ -846,29 +846,33 @@ function copyContent(evt) {
|
||||
var plugins = [];
|
||||
|
||||
if (loot.game) {
|
||||
loot.game.globalMessages.forEach(function(message){
|
||||
var m = {};
|
||||
messages.push({
|
||||
type: message.type,
|
||||
content: message.content[0].str
|
||||
if (loot.game.globalMessages) {
|
||||
loot.game.globalMessages.forEach(function(message){
|
||||
var m = {};
|
||||
messages.push({
|
||||
type: message.type,
|
||||
content: message.content[0].str
|
||||
});
|
||||
});
|
||||
});
|
||||
loot.game.plugins.forEach(function(plugin){
|
||||
plugins.push({
|
||||
name: plugin.name,
|
||||
crc: plugin.crc,
|
||||
version: plugin.version,
|
||||
isActive: plugin.isActive,
|
||||
isDummy: plugin.isDummy,
|
||||
loadsBSA: plugin.loadsBSA,
|
||||
}
|
||||
if (loot.game.plugins) {
|
||||
loot.game.plugins.forEach(function(plugin){
|
||||
plugins.push({
|
||||
name: plugin.name,
|
||||
crc: plugin.crc,
|
||||
version: plugin.version,
|
||||
isActive: plugin.isActive,
|
||||
isDummy: plugin.isDummy,
|
||||
loadsBSA: plugin.loadsBSA,
|
||||
|
||||
modPriority: plugin.modPriority,
|
||||
isGlobalPriority: plugin.isGlobalPriority,
|
||||
messages: plugin.messages,
|
||||
tags: plugin.tags,
|
||||
isDirty: plugin.isDirty
|
||||
modPriority: plugin.modPriority,
|
||||
isGlobalPriority: plugin.isGlobalPriority,
|
||||
messages: plugin.messages,
|
||||
tags: plugin.tags,
|
||||
isDirty: plugin.isDirty
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var message = document.getElementById('generalMessagesList').getElementsByTagName('ul')[0].firstElementChild;
|
||||
if (message) {
|
||||
@@ -891,7 +895,7 @@ function copyContent(evt) {
|
||||
}
|
||||
function areSettingsValid() {
|
||||
/* Validate inputs individually. */
|
||||
var inputs = document.getElementById('settings').getElementsByTagName('input');
|
||||
var inputs = document.getElementById('settingsDialog').getElementsByTagName('input');
|
||||
for (var i = 0; i < inputs.length; ++i) {
|
||||
if (!inputs[i].checkValidity()) {
|
||||
return false;
|
||||
@@ -977,7 +981,7 @@ function closeSettingsDialog(evt) {
|
||||
}
|
||||
|
||||
function showSettingsDialog(evt) {
|
||||
document.getElementById('settings').showModal();
|
||||
document.getElementById('settingsDialog').showModal();
|
||||
}
|
||||
|
||||
function startSearch(evt) {
|
||||
@@ -1195,7 +1199,7 @@ function setupEventHandlers() {
|
||||
document.getElementById('sidebarTabs').addEventListener('core-select', switchSidebarTab, false);
|
||||
|
||||
/* Set up event handlers for settings dialog. */
|
||||
var settings = document.getElementById('settings');
|
||||
var settings = document.getElementById('settingsDialog');
|
||||
settings.getElementsByClassName('accept')[0].addEventListener('click', closeSettingsDialog, false);
|
||||
settings.getElementsByClassName('cancel')[0].addEventListener('click', closeSettingsDialog, false);
|
||||
|
||||
@@ -1239,7 +1243,13 @@ function initVars() {
|
||||
|
||||
/* Now fill in language options. */
|
||||
var settingsLangSelect = document.getElementById('languageSelect');
|
||||
var messageLangSelect = document.querySelector('link[rel="import"][href$="editable-table.html"]').import.querySelector('#messageRow').content.querySelector('.language');
|
||||
var messageLangSelect = document.querySelector('link[rel="import"][href$="editable-table.html"]');
|
||||
if (messageLangSelect) {
|
||||
messageLangSelect = messageLangSelect.import.querySelector('#messageRow').content.querySelector('.language');
|
||||
} else {
|
||||
messageLangSelect = document.querySelector('#messageRow').content.querySelector('.language');
|
||||
}
|
||||
|
||||
for (var i = 0; i < loot.languages.length; ++i) {
|
||||
var settingsItem = document.createElement('paper-item');
|
||||
settingsItem.setAttribute('value', loot.languages[i].locale);
|
||||
@@ -1290,7 +1300,12 @@ function initVars() {
|
||||
}
|
||||
|
||||
/* Fill in game row template's game type options. */
|
||||
var select = document.querySelector('link[rel="import"][href$="editable-table.html"]').import.querySelector('#gameRow').content.querySelector('select');
|
||||
var select = document.querySelector('link[rel="import"][href$="editable-table.html"]');
|
||||
if (select) {
|
||||
select = select.import.querySelector('#gameRow').content.querySelector('select')
|
||||
} else {
|
||||
select = document.querySelector('#gameRow').content.querySelector('select');
|
||||
}
|
||||
for (var j = 0; j < loot.gameTypes.length; ++j) {
|
||||
var option = document.createElement('option');
|
||||
option.value = loot.gameTypes[j];
|
||||
|
||||
@@ -181,7 +181,7 @@ along with LOOT. If not, see <http://www.gnu.org/licenses/>.
|
||||
<paper-button affirmative autofocus>OK</paper-button>
|
||||
</loot-dialog>
|
||||
|
||||
<loot-dialog id="settings" heading="Settings" closeSelector="">
|
||||
<loot-dialog id="settingsDialog" heading="Settings" closeSelector="">
|
||||
<div center horizontal layout>
|
||||
<div>Default Game</div>
|
||||
<loot-dropdown-menu id="defaultGameSelect">
|
||||
|
||||
Reference in New Issue
Block a user