Creating Menus, Variable Persistence.

Greetings, all. This post has a few points of confluence, so apologies if I'm putting it in the wrong place.

I'm currently working on a game with gathering intelligence as a central mechanic, with additional notes on the history and political situation of the setting to be included.

I've only been working with JavaScript for about a year, and am also somewhat out of practice, so I'm at a bit of a loss as to how to properly use MV's Scene_Menu to build the system of windows and populate them with information. I have YanFly's Main Menu Manager plugin to graft the new 'Intel' option into the main menu, but that only gets me as far as calling the event sequence to build the menu.

Below is the code as I have it written in a separate file.

Spoiler: Code block
//Define the archetype of an intel object; categories are for sorting, topics represent the individual subject of the note.
function intel(category,topic,contents) {
this.category = category;
this.topic = topic;
this.contents = contents;
this.categoryMatches = function(targetNote) {
return(this.topic.valueOf() === targetNote.topic.valueOf());
}
this.matches = function(targetNote){
return(this.category.toLowerCase().LocaleCompare(targetNote.category.valueOf()));
};
this.belongsToCategory(catName){
return (this.category.valueOf() === catName.valueOf());
};
};

var intelList = {
notes = [],
categories = [],

//If the note given isn't already in the list, add it. Returns true if the note was added to the list.
addNote = function(newNote){
if (!categories.some(newNote.categoryMatches)) {
categories.push(newNote.category);
};
//Sets to false once the position for the note is found, or a copy is already in the list.
var searching = true;
var inserted = false;
var checkedNotes = [];

while (searching & this.notes.length > 0) {
var matchValue = newNote.matches(this.notes[noteIndex]);
//A matchValue of 1 means the note to be added comes after the note at the start of the notes array.
if (matchValue === 1) {
checkedNotes.push(this.notes.shift());
} else if (matchValue === 0) { //A matchValue of 0 means the note is already in the list.
searching = false;
} else { //A value of -1 means the note to be added comes before the current member of notes.
checkedNotes.push(newNote);
inserted = true;
};
};
//Catches additions when the list is empty, and cases where the new note goes on the end of the list.
if (notes.length === 0 & searching) {
this.notes.push(checkedNotes.push(newNote));
inserted = true;
};
//the concat function adds the array given as an argument to the end of the array calling the function. This way keeps alphabetical order,
this.notes = checkedNotes.concat(this.notes);
return (inserted);
},

//Used to get the footnotes belonging to a particular category.
getFromCategory = function(category){
return(this.notes.filter(belongsToCategory(category)));
}
}


function Scene_Intel(){this.initialize.apply(this, arguments);}
Scene_Intel.prototype = Object.create(Scene_MenuBase.prototype);
Scene_Intel.prototype.constructor = Scene_Footnotes;
Scene_Intel.prototype.prepare = function(ai_id){
.scene_id = ai_id;
};
Scene_Intel.prototype.initialize = function() {
Scene_MenuBase.prototype.initialize.call(this);
};
Scene_Intel.prototype.start = function() {
Scene_MenuBase.prototype.start.call(this);
};

Scene_Intel.prototype.create = function(){
Scene_MenuBase.prototype.create.call(this);
this.get_ai_data();
this.create_window();
};

Scene_Intel.prototype.update = function(){
Scene_MenuBase.prototype.update.call(this);
};

I have several questions about what I'm doing here.
1) If I were to integrate this code as a plugin, would it come before or after Yanfly's Main Menu Manager plugin in order for the variables called to be accessible while setting up the MMM plugin?
2) Will the contents of intelList persist across save files if I transfer it to a Common Event, divided up into multiple entries so as to circumvent the character limit to Script entries in the MV Event Editor?
3) Based on my admittedly limited understanding of Prototypes, the way the code is currently written causes Scene_Intel to inherit the functions defined by the Scene_MenuBase prototype. Which of these need to stay as they are?
4) Which of the Scene_Intel prototype methods do I need to pass the intelList variable in order for the menu to be populated with entries from said list?
5) Would I need a separate set of objects to filter the contents of the Intel window via intelList.categories? If not, where would that portion need to be integrated?

Any assistance would be greatly appreciated, as a proper understanding of the use of Scene_MenuBase is also necessary for the more complicated task I have to handle following this.



EDIT: After a couple of days trying to work the answers out on my own, this is what I still need to know:
1) Where do I need to define the intelList object so that its contents will be treated as a persistent global variable?

2) How do I go about making Scene_Intel display the list of intel objects in one window, with the text contained in the highlighted intel's .contents string shown in a second, larger window?

3) If I've defined Scene_Intel and it's prototype/functions in a separate JavaScript file, and I want it to be used to add an item to the Main Menu via Yanfly's Main Menu Manager plugin, would I load it as a plugin before or after the MMM plugin? Or would I have to insert the code into the rpg_scenes.js file associated with my game?

Original thread: https://forums.rpgmakerweb.com/threads/creating-menus-variable-persistence.80081/