From 09be91347731f5ccd2c4d37cae280dced2429866 Mon Sep 17 00:00:00 2001 From: WrinklyNinja Date: Sat, 19 Jul 2014 16:49:22 +0100 Subject: [PATCH] Fixed hiding editor panels, and tidied up other JS. --- resources/report/js/custom.js | 2 +- resources/report/js/plugin.js | 37 +++++++++++++++++++------- resources/report/js/script.js | 49 +++++++++++++++++++++++------------ 3 files changed, 61 insertions(+), 27 deletions(-) diff --git a/resources/report/js/custom.js b/resources/report/js/custom.js index 138f9a33..9d2edd2d 100644 --- a/resources/report/js/custom.js +++ b/resources/report/js/custom.js @@ -77,7 +77,7 @@ var pluginCardProto = Object.create(HTMLElement.prototype, { document.getElementsByTagName('header')[0].classList.toggle('editMode', false); /* Hide editor. */ - evt.target.parentElement.parentElement.parentElement.classList.toggle('flip'); + evt.target.parentElement.parentElement.parentNode.host.classList.toggle('flip'); } } }, diff --git a/resources/report/js/plugin.js b/resources/report/js/plugin.js index 07820a7f..c41ee8bf 100644 --- a/resources/report/js/plugin.js +++ b/resources/report/js/plugin.js @@ -74,6 +74,33 @@ function Plugin(obj) { } + Plugin.prototype.getPriorityString = function() { + var priorityText = 'Priority: ' + this.modPriority + ', Global: '; + if (this.isGlobalPriority) { + priorityText += '✓'; + } else { + priorityText += '✗'; + } + return priorityText; + } + + Plugin.prototype.getConflictingPlugins = function() { + var request = { + name: 'getConflictingPlugins', + args: [ + this.name + ] + }; + + var request_id = window.cefQuery({ + request: JSON.stringify(request), + persistent: false, + onSuccess: function(response) {}, + onFailure: function(error_code, error_message) { + showMessageBox('error', "Error", "Error code: " + error_code + "; " + error_message); + } + }); + } Plugin.prototype.createCard = function() { var card = new PluginCard(); @@ -139,16 +166,6 @@ function Plugin(obj) { document.getElementById('main').appendChild(card); } - Plugin.prototype.getPriorityString = function() { - var priorityText = 'Priority: ' + this.modPriority + ', Global: '; - if (this.isGlobalPriority) { - priorityText += '✓'; - } else { - priorityText += '✗'; - } - return priorityText; - } - Plugin.prototype.createListItem = function() { var li = new PluginListItem(); diff --git a/resources/report/js/script.js b/resources/report/js/script.js index a576a9e6..c32b6926 100644 --- a/resources/report/js/script.js +++ b/resources/report/js/script.js @@ -82,10 +82,7 @@ function toggleDisplayCSS(evt) { } } } -function getConflictingPlugins(filename) { - /* This would be a C++ function interface, but using a dummy function to test the UI. */ - return ['Skyrim.esm', 'Unofficial Skyrim Patch.esp', 'Wyrmstooth.esp', 'RaceMenu.esp', 'Run For Your Lives.esp']; -} + function togglePlugins(evt) { var sections = document.getElementById('main').children; var entries = document.getElementById('pluginsNav').children; @@ -204,33 +201,53 @@ function openReadme(evt) { }); } function updateMasterlist(evt) { - + var request_id = window.cefQuery({ + request: 'updateMasterlist', + persistent: false, + onSuccess: function(response) {}, + onFailure: function(error_code, error_message) { + showMessageBox('error', "Error", "Error code: " + error_code + "; " + error_message); + } + }); } function sortPlugins(evt) { - + var request_id = window.cefQuery({ + request: 'sortPlugins', + persistent: false, + onSuccess: function(response) {}, + onFailure: function(error_code, error_message) { + showMessageBox('error', "Error", "Error code: " + error_code + "; " + error_message); + } + }); } function applySort(evt) { - + var request_id = window.cefQuery({ + request: 'applySort', + persistent: false, + onSuccess: function(response) {}, + onFailure: function(error_code, error_message) { + showMessageBox('error', "Error", "Error code: " + error_code + "; " + error_message); + } + }); } function cancelSort(evt) { - + var request_id = window.cefQuery({ + request: 'cancelSort', + persistent: false, + onSuccess: function(response) {}, + onFailure: function(error_code, error_message) { + showMessageBox('error', "Error", "Error code: " + error_code + "; " + error_message); + } + }); } 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?'); //showMessageBox('info', 'Redate Plugins', 'Plugins were successfully redated.'); -} -function copyMetadata(evt) { - } function clearAllMetadata(evt) { showMessageDialog('Clear All Metadata', 'Are you sure you want to clear all existing user-added metadata from all plugins?'); } -function clearMetadata(evt) { - var filename = evt.target.getAttribute('data-target'); - showMessageDialog('Clear Plugin Metadata', 'Are you sure you want to clear all existing user-added metadata from "' + filename + '"?'); -} - function handlePluginDrop(evt) { evt.stopPropagation();