Skip to content

Commit

Permalink
merge from master
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenegriffin committed Sep 19, 2020
2 parents 5a87c22 + 9147052 commit c360b23
Show file tree
Hide file tree
Showing 25 changed files with 230 additions and 79 deletions.
4 changes: 4 additions & 0 deletions src/Content/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,8 @@ td {
height: 44px;
background-color: #f4f4f4;
padding: 0;
}

.ms-Button-icon {
display: inline-block;
}
6 changes: 5 additions & 1 deletion src/Content/MobilePane-ios.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,11 @@

.tabs .tab {
padding-top: 25px;
background: #efeff4;
background: #f4f4f4;
}

.page {
background: #f4f4f4;
}

.content-block-title{
Expand Down
7 changes: 0 additions & 7 deletions src/Content/uiToggle.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,6 @@ body, html {
border: none;
}

.gear-button {
min-width: 0;
width: 35px;
height: 44px;
margin-top: 1px;
}

.code-box > pre {
background-color: #eaeaea;
border: 1px solid #ccc;
Expand Down
1 change: 1 addition & 0 deletions src/Pages/classicDesktopFrame.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
<script src="/node_modules/jwt-decode/build/jwt-decode.min.js"></script>
<script src="/Scripts/%version%/Strings.min.js"></script>
<script src="/Scripts/%version%/Dates.min.js"></script>
<script src="/Scripts/%version%/message.min.js"></script>
<script src="/Scripts/%version%/Antispam.min.js"></script>
<script src="/Scripts/%version%/ForefrontAntispam.min.js"></script>
<script src="/Scripts/%version%/2047.min.js"></script>
Expand Down
15 changes: 13 additions & 2 deletions src/Pages/mha.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<title>Message Header Analyzer</title>

<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.5.0/css/fabric.min.css">
<link rel="stylesheet" href="https://static2.sharepointonline.com/files/fabric/office-ui-fabric-js/1.5.0/css/fabric.components.min.css">
<link rel="stylesheet" type="text/css" href="/Content/%version%/Office.css" />
<link rel="stylesheet" type="text/css" href="/Content/%version%/App.css" />

Expand Down Expand Up @@ -43,6 +45,7 @@

<script src="/Scripts/%version%/Strings.min.js"></script>
<script src="/Scripts/%version%/Dates.min.js"></script>
<script src="/Scripts/%version%/message.min.js"></script>
<script src="/Scripts/%version%/Antispam.min.js"></script>
<script src="/Scripts/%version%/ForefrontAntispam.min.js"></script>
<script src="/Scripts/%version%/2047.min.js"></script>
Expand All @@ -60,8 +63,16 @@ <h1 id="title">Message Header Analyzer</h1>
</div>
<div id="SectionContent">
<textarea id="inputHeaders" autofocus="autofocus" placeholder="Paste headers here." required="required" rows="15"></textarea>
<input onclick="StandAlone.analyze()" type="button" value="Analyze headers" />
<input id="clearButton" class="hiddenElement" onclick="StandAlone.clear()" type="button" value="Clear" />
<button class="ms-Button ms-Button--primary" onclick="StandAlone.analyze()">
<span class="ms-Button-label">Analyze headers</span>
</button>
<button class="ms-Button hiddenElement" id="clearButton" onclick="StandAlone.clear()" value="Clear">
<span class="ms-Button-label">Clear</span>
</button>
<button class="ms-Button hiddenElement" id="copyButton" onclick="StandAlone.copy()" value="Copy">
<span class="ms-Button-icon"><i class="ms-Icon ms-Icon--Copy"></i></span>
<span class="ms-Button-label">Copy</span>
</button>
<span id="mhaFooter">
<a href="https://github.com/stephenegriffin/mha" target="_blank">Submit feedback on github</a>
</span>
Expand Down
1 change: 1 addition & 0 deletions src/Pages/newDesktopFrame.html
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@

<script src="/Scripts/%version%/Strings.min.js"></script>
<script src="/Scripts/%version%/Dates.min.js"></script>
<script src="/Scripts/%version%/message.min.js"></script>
<script src="/Scripts/%version%/Antispam.min.js"></script>
<script src="/Scripts/%version%/ForefrontAntispam.min.js"></script>
<script src="/Scripts/%version%/2047.min.js"></script>
Expand Down
1 change: 1 addition & 0 deletions src/Pages/newMobilePaneIosFrame.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

<script src="/Scripts/%version%/Strings.min.js"></script>
<script src="/Scripts/%version%/Dates.min.js"></script>
<script src="/Scripts/%version%/message.min.js"></script>
<script src="/Scripts/%version%/Antispam.min.js"></script>
<script src="/Scripts/%version%/ForefrontAntispam.min.js"></script>
<script src="/Scripts/%version%/2047.min.js"></script>
Expand Down
20 changes: 14 additions & 6 deletions src/Pages/parentframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
<script src="/node_modules/jwt-decode/build/jwt-decode.min.js"></script>
<script src="/Scripts/%version%/Strings.min.js"></script>
<script src="/Scripts/%version%/Dates.min.js"></script>
<script src="/Scripts/%version%/message.min.js"></script>
<script src="/Scripts/%version%/Errors.min.js"></script>
<script src="/Scripts/%version%/GetHeaders.min.js"></script>
<script src="/Scripts/%version%/GetHeadersEWS.min.js"></script>
Expand All @@ -49,12 +50,19 @@
<body class="ms-Fabric">
<div id="uiToggleFrame">
<div class="header-row">
<div class="ms-Style-button">
<button class="ms-Button ms-Button--hero dialog-button gear-button">
<span class="ms-Button-label">
<i class="ms-Icon ms-Icon--Settings" aria-hidden="true"></i>
</span>
</button>
<div class="ms-CommandBar">
<div class="ms-CommandBar-mainArea">
<div class="ms-CommandButton">
<button class="ms-CommandButton-button copy-button">
<span class="ms-CommandButton-icon ms-fontColor-themePrimary"><i class="ms-Icon ms-Icon--Copy"></i></span>
</button>
</div>
<div class="ms-CommandButton">
<button class="ms-CommandButton-button gear-button">
<span class="ms-CommandButton-icon ms-fontColor-themePrimary"><i class="ms-Icon ms-Icon--Settings"></i></span>
</button>
</div>
</div>
</div>

<!-- Settings Dialog-->
Expand Down
1 change: 1 addition & 0 deletions src/Pages/unittests.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
</script>
<script src="/Scripts/%version%/Strings.min.js"></script>
<script src="/Scripts/%version%/Dates.min.js"></script>
<script src="/Scripts/%version%/message.min.js"></script>
<script src="/Scripts/%version%/Antispam.min.js"></script>
<script src="/Scripts/%version%/ForefrontAntispam.min.js"></script>
<script src="/Scripts/%version%/2047.min.js"></script>
Expand Down
14 changes: 12 additions & 2 deletions src/Scripts/Antispam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ var AntiSpamReport = (function () {
label: label,
headerName: headerName,
value: "",
valueUrl: ""
valueUrl: "",
toString: function () { return this.label + ": " + this.value; }

}
};

Expand Down Expand Up @@ -92,6 +94,14 @@ var AntiSpamReport = (function () {
get source() { return source; },
get unparsed() { return unparsed; },
get antiSpamRows() { return antiSpamRows; },
row: row
row: row,
toString: function () {
if (!exists()) return "";
var ret = ["AntiSpamReport"];
antiSpamRows.forEach(function (row) {
if (row.value) { ret.push(row); }
});
return ret.join("\n");
}
};
});
13 changes: 4 additions & 9 deletions src/Scripts/Default.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
/* global mhaStrings */
/* global HeaderModel */
/* global Table */
/* global message */

// This is the "classic" UI rendered in classicDesktopFrame.html

Expand All @@ -17,22 +18,16 @@
Table.initializeTableUI(viewModel);
updateStatus(mhaStrings.mha_loading);
window.addEventListener("message", eventListener, false);
postMessageToParent("frameActive");
message.postMessageToParent("frameActive");
}
catch (e) {
postError(e, "Failed initializing frame");
showError(e, "Failed initializing frame");
}
});

function site() { return window.location.protocol + "//" + window.location.host; }

function postMessageToParent(eventName, data) {
window.parent.postMessage({ eventName: eventName, data: data }, site());
}

function eventListener(event) {
if (!event || event.origin !== site()) return;
if (!event || event.origin !== message.site()) return;

if (event.data) {
switch (event.data.eventName) {
Expand All @@ -50,7 +45,7 @@
}

function postError(error, message) {
postMessageToParent("LogError", { error: JSON.stringify(error), message: message });
message.postMessageToParent("LogError", { error: JSON.stringify(error), message: message });
}

function enableSpinner() {
Expand Down
14 changes: 4 additions & 10 deletions src/Scripts/DesktopPane.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/* global $ */
/* global mhaStrings */
/* global HeaderModel */
/* global message */

// This is the "new" UI rendered in newDesktopFrame.html

Expand All @@ -15,22 +16,16 @@
initializeFabric();
updateStatus(mhaStrings.mha_loading);
window.addEventListener("message", eventListener, false);
postMessageToParent("frameActive");
message.postMessageToParent("frameActive");
}
catch (e) {
postError(e, "Failed initializing frame");
showError(e, "Failed initializing frame");
}
});

function site() { return window.location.protocol + "//" + window.location.host; }

function postMessageToParent(eventName, data) {
window.parent.postMessage({ eventName: eventName, data: data }, site());
}

function eventListener(event) {
if (!event || event.origin !== site()) return;
if (!event || event.origin !== message.site()) return;

if (event.data) {
switch (event.data.eventName) {
Expand All @@ -48,7 +43,7 @@
}

function postError(error, message) {
postMessageToParent("LogError", { error: JSON.stringify(error), message: message });
message.postMessageToParent("LogError", { error: JSON.stringify(error), message: message });
}

function initializeFabric() {
Expand Down Expand Up @@ -269,7 +264,6 @@
var tbody;
var table;
var row;
var linkVal;
if (viewModel.forefrontAntiSpamReport.forefrontAntiSpamRows.length > 0) {
$("<div/>")
.addClass("ms-font-m")
Expand Down
8 changes: 8 additions & 0 deletions src/Scripts/ForefrontAntispam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,13 @@ var ForefrontAntiSpamReport = (function () {
get source() { return antiSpamReport.source; },
get unparsed() { return antiSpamReport.unparsed; },
get forefrontAntiSpamRows() { return forefrontAntiSpamRows; },
toString: function () {
if (!exists()) return "";
var ret = ["ForefrontAntiSpamReport"];
forefrontAntiSpamRows.forEach(function (row) {
if (row.value) { ret.push(row); }
});
return ret.join("\n");
}
};
});
19 changes: 17 additions & 2 deletions src/Scripts/Headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
/* global Other */
/* global Received */
/* global Summary */
/* global message */
/* exported HeaderModel */

var HeaderModel = (function (headers) {
Expand Down Expand Up @@ -118,7 +119,20 @@ var HeaderModel = (function (headers) {
return headerList;
}

if (headers) { parseHeaders(headers); }
function toString() {
var ret = [];
if (summary.exists()) ret.push(summary);
if (receivedHeaders.exists()) ret.push(receivedHeaders);
if (forefrontAntiSpamReport.exists()) ret.push(forefrontAntiSpamReport);
if (antiSpamReport.exists()) ret.push(antiSpamReport);
if (otherHeaders.exists()) ret.push(otherHeaders);
return ret.join("\n\n");
}

if (headers) {
parseHeaders(headers);
message.postMessageToParent("modelToString", toString());
}

return {
originalHeaders: originalHeaders,
Expand All @@ -130,6 +144,7 @@ var HeaderModel = (function (headers) {
get hasData() { return hasData || status; },
GetHeaderList: GetHeaderList,
get status() { return status; },
set status(value) { status = value; }
set status(value) { status = value; },
toString: toString
};
});
13 changes: 4 additions & 9 deletions src/Scripts/MobilePane-ios.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
/* global moment */
/* global mhaStrings */
/* global HeaderModel */
/* global message */

// This is the "new-mobile" UI rendered in newMobilePaneIosFrame.html

Expand All @@ -17,22 +18,16 @@
initializeFramework7();
updateStatus(mhaStrings.mha_loading);
window.addEventListener("message", eventListener, false);
postMessageToParent("frameActive");
message.postMessageToParent("frameActive");
}
catch (e) {
postError(e, "Failed initializing frame");
showError(e, "Failed initializing frame");
}
});

function site() { return window.location.protocol + "//" + window.location.host; }

function postMessageToParent(eventName, data) {
window.parent.postMessage({ eventName: eventName, data: data }, site());
}

function eventListener(event) {
if (!event || event.origin !== site()) return;
if (!event || event.origin !== message.site()) return;

if (event.data) {
switch (event.data.eventName) {
Expand All @@ -50,7 +45,7 @@
}

function postError(error, message) {
postMessageToParent("LogError", { error: JSON.stringify(error), message: message });
message.postMessageToParent("LogError", { error: JSON.stringify(error), message: message });
}

function initializeFramework7() {
Expand Down
15 changes: 12 additions & 3 deletions src/Scripts/Other.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ var Other = (function () {
number: number,
header: header,
url: mhaStrings.mapHeaderToURL(header, null),
value: value
value: value,
toString: function () { return header + ": " + value; }
}
};

Expand Down Expand Up @@ -49,6 +50,14 @@ var Other = (function () {
get otherRows() { return otherRows; },
doSort: doSort,
get sortColumn() { return sortColumn; },
get sortOrder() { return sortOrder; }
};
get sortOrder() { return sortOrder; },
toString: function () {
if (!exists()) return "";
var ret = ["Other"];
otherRows.forEach(function (row) {
if (row.value) { ret.push(row); }
});
return ret.join("\n");
}
}
});
Loading

0 comments on commit c360b23

Please sign in to comment.