Added toasts for masterlist update.

Added a function to simplify the code.
This commit is contained in:
Oliver Hamlet
2014-11-13 12:20:29 +00:00
parent e7f0a427e9
commit 92d5b9675d
+14 -16
View File
@@ -409,7 +409,11 @@ function toggleDisplayCSS(evt) {
}
}
}
function toast(text) {
var toast = document.getElementById('toast');
toast.text = text;
toast.show();
}
function getConflictingPluginsFromFilter() {
var conflictsPlugin = document.body.getAttribute('data-conflicts');
if (conflictsPlugin) {
@@ -613,6 +617,10 @@ function updateMasterlistNoProgress() {
}
}
});
toast('Masterlist updated to revision ' + loot.game.masterlist.revision + '.');
} else {
toast('No masterlist update was necessary.');
}
}).catch(processCefError);
}
@@ -808,9 +816,7 @@ function redatePlugins(evt) {
showMessageDialog('Redate Plugins', 'This feature is provided so that modders using the Creation Kit may set the load order it uses. A side-effect is that any subscribed Steam Workshop mods will be re-downloaded by Steam. Do you wish to continue?', false, function(result){
if (result) {
loot.query('redatePlugins').then(function(response){
var toast = document.getElementById('toast');
toast.text = 'Plugins were successfully redated.';
toast.show();
toast('Plugins were successfully redated.');
}).catch(processCefError);
}
});
@@ -837,9 +843,7 @@ function clearAllMetadata(evt) {
}
});
var toast = document.getElementById('toast');
toast.text = 'All user-added metadata has been cleared.';
toast.show();
toast.text('All user-added metadata has been cleared.');
}
}).catch(processCefError);
}
@@ -896,9 +900,7 @@ function copyContent(evt) {
});
loot.query(request).then(function(){
var toast = document.getElementById('toast');
toast.text = "LOOT's content has been copied to the clipboard.";
toast.show();
toast("LOOT's content has been copied to the clipboard.");
}).catch(processCefError);
}
function areSettingsValid() {
@@ -1119,9 +1121,7 @@ function handleCopyMetadata(evt) {
});
loot.query(request).then(function(){
var toast = document.getElementById('toast');
toast.text = 'The metadata for ' + evt.target.getName() + ' has been copied to the clipboard.';
toast.show();
toast('The metadata for ' + evt.target.getName() + ' has been copied to the clipboard.');
}).catch(processCefError);
}
function handleClearMetadata(evt) {
@@ -1153,9 +1153,7 @@ function handleClearMetadata(evt) {
break;
}
}
var toast = document.getElementById('toast');
toast.text = 'The user-added metadata for ' + evt.target.getName() + ' has been cleared.';
toast.show();
toast('The user-added metadata for ' + evt.target.getName() + ' has been cleared.');
}
}).catch(processCefError);
}