mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Move filter-related JS function into filters.js
This commit is contained in:
@@ -146,6 +146,51 @@ var filters = {
|
||||
},
|
||||
};
|
||||
|
||||
function getConflictingPluginsFromFilter() {
|
||||
var conflictsPlugin = document.body.getAttribute('data-conflicts');
|
||||
if (conflictsPlugin) {
|
||||
/* Now get conflicts for the plugin. */
|
||||
var request = JSON.stringify({
|
||||
name: 'getConflictingPlugins',
|
||||
args: [
|
||||
conflictsPlugin
|
||||
]
|
||||
});
|
||||
|
||||
showProgress(l10n.jed.translate('Checking if plugins have been loaded...').fetch());
|
||||
|
||||
return loot.query(request).then(JSON.parse).then(function(result){
|
||||
if (result) {
|
||||
/* Filter everything but the plugin itself if there are no
|
||||
conflicts. */
|
||||
var conflicts = [ conflictsPlugin ];
|
||||
for (var key in result) {
|
||||
if (result[key].conflicts) {
|
||||
conflicts.push(key);
|
||||
}
|
||||
for (var i = 0; i < loot.game.plugins.length; ++i) {
|
||||
if (loot.game.plugins[i].name == key) {
|
||||
loot.game.plugins[i].crc = result[key].crc;
|
||||
loot.game.plugins[i].isEmpty = result[key].isEmpty;
|
||||
|
||||
loot.game.plugins[i].messages = result[key].messages;
|
||||
loot.game.plugins[i].tags = result[key].tags;
|
||||
loot.game.plugins[i].isDirty = result[key].isDirty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
closeProgressDialog();
|
||||
return conflicts;
|
||||
}
|
||||
closeProgressDialog();
|
||||
return [ conflictsPlugin ];
|
||||
}).catch(processCefError);
|
||||
}
|
||||
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
function setFilteredUIData(evt) {
|
||||
/* The conflict filter, if enabled, executes C++ code, so needs to be
|
||||
handled using a promise, so the rest of the function should wait until
|
||||
|
||||
@@ -57,50 +57,6 @@ function toast(text) {
|
||||
toast.text = text;
|
||||
toast.show();
|
||||
}
|
||||
function getConflictingPluginsFromFilter() {
|
||||
var conflictsPlugin = document.body.getAttribute('data-conflicts');
|
||||
if (conflictsPlugin) {
|
||||
/* Now get conflicts for the plugin. */
|
||||
var request = JSON.stringify({
|
||||
name: 'getConflictingPlugins',
|
||||
args: [
|
||||
conflictsPlugin
|
||||
]
|
||||
});
|
||||
|
||||
showProgress(l10n.jed.translate('Checking if plugins have been loaded...').fetch());
|
||||
|
||||
return loot.query(request).then(JSON.parse).then(function(result){
|
||||
if (result) {
|
||||
/* Filter everything but the plugin itself if there are no
|
||||
conflicts. */
|
||||
var conflicts = [ conflictsPlugin ];
|
||||
for (var key in result) {
|
||||
if (result[key].conflicts) {
|
||||
conflicts.push(key);
|
||||
}
|
||||
for (var i = 0; i < loot.game.plugins.length; ++i) {
|
||||
if (loot.game.plugins[i].name == key) {
|
||||
loot.game.plugins[i].crc = result[key].crc;
|
||||
loot.game.plugins[i].isEmpty = result[key].isEmpty;
|
||||
|
||||
loot.game.plugins[i].messages = result[key].messages;
|
||||
loot.game.plugins[i].tags = result[key].tags;
|
||||
loot.game.plugins[i].isDirty = result[key].isDirty;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
closeProgressDialog();
|
||||
return conflicts;
|
||||
}
|
||||
closeProgressDialog();
|
||||
return [ conflictsPlugin ];
|
||||
}).catch(processCefError);
|
||||
}
|
||||
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
function showMessageDialog(title, text, positiveText, closeCallback) {
|
||||
var dialog = document.createElement('loot-message-dialog');
|
||||
dialog.setButtonText(positiveText, l10n.jed.translate('Cancel').fetch());
|
||||
|
||||
Reference in New Issue
Block a user