-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathpanel.js
107 lines (87 loc) · 3.57 KB
/
panel.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
var userAgentApplication = new Msal.UserAgentApplication('20d34c96-396e-4bf0-a008-472ef10a5099', null, function (errorDes, token, error, tokenType) {
// this callback is called after loginRedirect OR acquireTokenRedirect. It's not used with loginPopup, acquireTokenPopup.
if (error)
console.log(error + ": " + errorDes);
else
console.log("Token type = " + tokenType);
}, {
redirectUri: chrome.extension.getURL('app/panel.html'),
});
if (window.location.href.indexOf("#access_token=") < 0) {
var port = chrome.runtime.connect();
port.postMessage({ type: "init", tabId: chrome.devtools.inspectedWindow.tabId });
port.postMessage({ type: "autosavechange", content: false, tabId: chrome.devtools.inspectedWindow.tabId });
port.postMessage({ type: "autopublishchange", content: false, tabId: chrome.devtools.inspectedWindow.tabId });
riot.mount("sidebar"); // mount the left menu
swap('save'); // show first tab
var savetab = riot.mount("save"); // mount the first tab
require.config({ paths: { 'vs': 'monaco-editor/min/vs', 'js': 'js' } });
var graphman = null;
var graphmantoken = "";
var pnpjsconsole = null;
var graphsdkconsole = null;
var fileeditorsubs = [];
var fileeditormain = null;
var fileeditoreditor;
var appcatalogeditor;
var sitescriptseditor;
var selectedFile = null;
var selectedWebId = null;
var pageeditorlisteners = [];
var sitescriptslisteners = [];
var fileeditorlisteners = {};
var bgautosave = false;
var bgautopublish = false;
var modernpropertiesinitialized = false;
var modernpropertiesmain;
var filenames = [];
chrome.runtime.getPackageDirectoryEntry(function (directoryEntry) {
function getDir(directoryEntry, dir) {
directoryEntry.getDirectory(dir.replace('/crxfs', ''), {}, function (subDirectoryEntry) {
var directoryReader = subDirectoryEntry.createReader();
// List of DirectoryEntry and/or FileEntry objects.
directoryReader.readEntries(function (entries) {
if (entries.length) {
for (var i = 0; i < entries.length; ++i) {
if (entries[i].isFile) {
var fname = entries[i].fullPath.replace('/crxfs/app/', '');
//console.log(fname);
filenames.push(fname);
}
else getDir(directoryEntry, entries[i].fullPath.replace('/crxfs/', ''));
}
}
});
});
}
getDir(directoryEntry, 'app/@pnp');
getDir(directoryEntry, 'app/@microsoft');
getDir(directoryEntry, 'app/msal');
});
// this is called from multiple tabs, so it will be here
function addscriptlink(scope, scriptsequence, scriptpath) {
if (scriptpath == "") {
var script = sj + ' ' + alertify + ' ' + exescript + ' ' + alertError;
script += " exescript(alertError, 'Script path cannot be empty!');";
chrome.devtools.inspectedWindow.eval(script);
return;
}
else if (scriptsequence == "") {
var script = sj + ' ' + alertify + ' ' + exescript + ' ' + alertError;
script += " exescript(alertError, 'Sequence cannot be empty!');";
chrome.devtools.inspectedWindow.eval(script);
return;
}
var script = pnp + ' ' + sj + ' ' + alertify + ' ' + exescript + ' ' + addCustomAction;
script += " exescript(addCustomAction, '" + scope + "', '" + scriptpath + "', '" + scriptsequence + "');";
chrome.devtools.inspectedWindow.eval(script);
}
document.addEventListener('keydown', function (e) {
switch (e.keyCode) {
case 191:
e.stopImmediatePropagation();
break;
}
return;
}, true);
}