Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating to Bootstrap v4 #248

Merged
merged 29 commits into from
Aug 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d166dda
Started updating Bootstrap to v4
n1474335 Mar 2, 2018
5a7bb09
Fixed popovers in Bootstrap v4
n1474335 Mar 2, 2018
bcc8804
Updated buttons, fonts and collapse
n1474335 Mar 2, 2018
1ce6e32
Merged ESM into feature-bootstrap4. Started work on text inputs.
n1474335 Jun 9, 2018
27b0505
Merged ESM into feature-bootstrap4
n1474335 Jun 9, 2018
2bacd64
Converted operation arguments to material design
n1474335 Jun 10, 2018
7d410fc
Converted op-icons to material design and improved controls.
n1474335 Jun 10, 2018
4147ec7
Converted modals to Bootstrap 4 Material Design
n1474335 Jun 17, 2018
ab9bc7e
Fixed boolean arg checkboxes
n1474335 Jun 17, 2018
fa523e0
Changed banner icons to Material Design
n1474335 Jun 17, 2018
974ab29
Switched toggle string dropdown sides and removed form-control padding
n1474335 Jun 17, 2018
ba79144
Operation arguments are now arranged using CSS Grid
n1474335 Jun 18, 2018
7504f89
Fixed flow control operation argument text colour
n1474335 Jun 19, 2018
67dffbe
Actually fixed flow control operation argument text colour
n1474335 Jun 19, 2018
4338e26
Replaced Bootstrap alert with Material Design snackbar
n1474335 Jun 19, 2018
dcf3152
Operation cursor now indicates that it can be dragged
n1474335 Jun 19, 2018
052c32e
Arguments are now bordered white boxes again
n1474335 Jul 12, 2018
d182261
Switched to unbordered args
n1474335 Jul 13, 2018
a39e2c1
Fixed input and output cards
n1474335 Jul 13, 2018
ab44100
Changed table-condensed to table-sm
n1474335 Jul 13, 2018
651ca6c
Fixed all HTML operations
n1474335 Jul 15, 2018
ba5c503
Added Magic button and tweaked margins for Windows
n1474335 Jul 26, 2018
541e4ff
Added functionality to Magic button and improved the icon
n1474335 Jul 27, 2018
33b2fd8
Improved magic and staleness indicator animations
n1474335 Jul 27, 2018
035b6df
Added font and icon
n1474335 Jul 27, 2018
c3a3538
Linted
n1474335 Jul 27, 2018
2a55f13
Fixed themes for MD
n1474335 Aug 2, 2018
53b92ae
Further CSS tweaks
n1474335 Aug 3, 2018
a947e06
Added option to turn off background auto magic
n1474335 Aug 3, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
742 changes: 660 additions & 82 deletions package-lock.json

Large diffs are not rendered by default.

11 changes: 7 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.6.1",
"bootstrap": "^4.1.1",
"colors": "^1.3.0",
"css-loader": "^0.28.11",
"eslint": "^4.19.1",
Expand All @@ -55,12 +56,12 @@
"ink-docstrap": "^1.3.2",
"js-to-mjs": "^0.2.0",
"jsdoc-babel": "^0.4.0",
"less": "^3.0.2",
"less-loader": "^4.1.0",
"node-sass": "^4.9.0",
"postcss-css-variables": "^0.8.1",
"postcss-import": "^11.1.0",
"postcss-loader": "^2.1.4",
"prompt": "^1.0.0",
"sass-loader": "^7.0.2",
"sitemap": "^1.13.0",
"style-loader": "^0.21.0",
"url-loader": "^1.0.1",
Expand All @@ -71,13 +72,13 @@
"worker-loader": "^1.1.1"
},
"dependencies": {
"arrive": "^2.4.1",
"babel-plugin-transform-builtin-extend": "1.1.2",
"babel-polyfill": "^6.26.0",
"bcryptjs": "^2.4.3",
"bignumber.js": "^7.0.1",
"bootstrap": "^3.3.7",
"bootstrap-colorpicker": "^2.5.2",
"bootstrap-switch": "^3.3.4",
"bootstrap-material-design": "^4.1.1",
"bson": "^2.0.6",
"chi-squared": "^1.1.0",
"crypto-api": "^0.8.0",
Expand Down Expand Up @@ -108,7 +109,9 @@
"node-md6": "^0.1.0",
"nwmatcher": "^1.4.4",
"otp": "^0.1.3",
"popper.js": "^1.12.9",
"scryptsy": "^2.0.0",
"snackbarjs": "^1.1.0",
"sortablejs": "^1.7.0",
"split.js": "^1.3.5",
"ssdeep.js": "0.0.2",
Expand Down
6 changes: 6 additions & 0 deletions src/core/Ingredient.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ class Ingredient {
this.name = "";
this.type = "";
this._value = null;
this.disabled = false;
this.hint = "";
this.toggleValues = [];
this.target = null;

if (ingredientConfig) {
this._parseConfig(ingredientConfig);
Expand All @@ -39,7 +42,10 @@ class Ingredient {
this.name = ingredientConfig.name;
this.type = ingredientConfig.type;
this.defaultValue = ingredientConfig.value;
this.disabled = !!ingredientConfig.disabled;
this.hint = ingredientConfig.hint || false;
this.toggleValues = ingredientConfig.toggleValues;
this.target = typeof ingredientConfig.target !== "undefined" ? ingredientConfig.target : null;
}


Expand Down
11 changes: 8 additions & 3 deletions src/core/Operation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,17 @@ class Operation {
*/
get args() {
return this._ingList.map(ing => {
return {
const conf = {
name: ing.name,
type: ing.type,
value: ing.defaultValue,
toggleValues: ing.toggleValues || []
value: ing.defaultValue
};

if (ing.toggleValues) conf.toggleValues = ing.toggleValues;
if (ing.hint) conf.hint = ing.hint;
if (ing.disabled) conf.disabled = ing.disabled;
if (ing.target) conf.target = ing.target;
return conf;
});
}

Expand Down
58 changes: 29 additions & 29 deletions src/core/Utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -828,11 +828,11 @@ class Utils {
*/
static async displayFilesAsHTML(files) {
const formatDirectory = function(file) {
const html = `<div class='panel panel-default' style='white-space: normal;'>
<div class='panel-heading' role='tab'>
<h4 class='panel-title'>
const html = `<div class='card' style='white-space: normal;'>
<div class='card-header'>
<h6 class="mb-0">
${Utils.escapeHtml(file.name)}
</h4>
</h6>
</div>
</div>`;
return html;
Expand All @@ -845,38 +845,38 @@ class Utils {
{type: "octet/stream"}
);

const html = `<div class='panel panel-default' style='white-space: normal;'>
<div class='panel-heading' role='tab' id='heading${i}'>
<h4 class='panel-title'>
<div>
<a href='#collapse${i}'
class='collapsed'
data-toggle='collapse'
aria-expanded='true'
aria-controls='collapse${i}'
title="Show/hide contents of '${Utils.escapeHtml(file.name)}'">${Utils.escapeHtml(file.name)}</a>
<a href='${URL.createObjectURL(blob)}'
title='Download ${Utils.escapeHtml(file.name)}'
download='${Utils.escapeHtml(file.name)}'>&#x1f4be;</a>
<span class='pull-right'>
${file.size.toLocaleString()} bytes
</span>
</div>
</h4>
const html = `<div class='card' style='white-space: normal;'>
<div class='card-header' id='heading${i}'>
<h6 class='mb-0'>
<a class='collapsed'
data-toggle='collapse'
href='#collapse${i}'
aria-expanded='false'
aria-controls='collapse${i}'
title="Show/hide contents of '${Utils.escapeHtml(file.name)}'">
${Utils.escapeHtml(file.name)}</a>
<span class='float-right' style="margin-top: -3px">
${file.size.toLocaleString()} bytes
<a title="Download ${Utils.escapeHtml(file.name)}"
href='${URL.createObjectURL(blob)}'
download='${Utils.escapeHtml(file.name)}'>
<i class="material-icons" style="vertical-align: bottom">save</i>
</a>
</span>
</h6>
</div>
<div id='collapse${i}' class='panel-collapse collapse'
role='tabpanel' aria-labelledby='heading${i}'>
<div class='panel-body'>
<pre><code>${Utils.escapeHtml(Utils.arrayBufferToStr(buff.buffer))}</code></pre>
<div id='collapse${i}' class='collapse' aria-labelledby='heading${i}' data-parent="#files">
<div class='card-body'>
<pre>${Utils.escapeHtml(Utils.arrayBufferToStr(buff.buffer))}</pre>
</div>
</div>
</div>`;
return html;
};

let html = `<div style='padding: 5px; white-space: normal;'>
${files.length} file(s) found<NL>
</div>`;
${files.length} file(s) found
</div><div id="files" style="padding: 20px">`;

for (let i = 0; i < files.length; i++) {
if (files[i].name.endsWith("/")) {
Expand All @@ -886,7 +886,7 @@ class Utils {
}
}

return html;
return html += "</div>";
}


Expand Down
4 changes: 2 additions & 2 deletions src/core/lib/CanvasComponents.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export function drawBarChart(canvas, scores, xAxisLabel, yAxisLabel, numXLabels,
leftPadding = canvas.width * 0.08,
rightPadding = canvas.width * 0.03,
topPadding = canvas.height * 0.08,
bottomPadding = canvas.height * 0.15,
bottomPadding = canvas.height * 0.2,
graphHeight = canvas.height - topPadding - bottomPadding,
graphWidth = canvas.width - leftPadding - rightPadding,
base = topPadding + graphHeight,
Expand Down Expand Up @@ -146,7 +146,7 @@ export function drawScaleBar(canvas, score, max, markings) {
leftPadding = canvas.width * 0.01,
rightPadding = canvas.width * 0.01,
topPadding = canvas.height * 0.1,
bottomPadding = canvas.height * 0.3,
bottomPadding = canvas.height * 0.35,
barHeight = canvas.height - topPadding - bottomPadding,
barWidth = canvas.width - leftPadding - rightPadding;

Expand Down
4 changes: 2 additions & 2 deletions src/core/lib/DateTime.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ export const DATETIME_FORMATS = [
* MomentJS DateTime formatting examples.
*/
export const FORMAT_EXAMPLES = `Format string tokens:
<table class="table table-striped table-hover table-condensed table-bordered" style="font-family: sans-serif">
<thead>
<table class="table table-striped table-hover table-sm table-bordered" style="font-family: sans-serif">
<thead class="thead-dark">
<tr>
<th>Category</th>
<th>Token</th>
Expand Down
5 changes: 3 additions & 2 deletions src/core/operations/Diff.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,10 @@ class Diff extends Operation {
"value": true
},
{
"name": "Ignore whitespace (relevant for word and line)",
"name": "Ignore whitespace",
"type": "boolean",
"value": false
"value": false,
"hint": "Relevant for word and line"
}
];
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/operations/Magic.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class Magic extends Operation {
const currentRecipeConfig = this.state.opList.map(op => op.config);

let output = `<table
class='table table-hover table-condensed table-bordered'
class='table table-hover table-sm table-bordered'
style='table-layout: fixed;'>
<tr>
<th>Recipe (click to load)</th>
Expand Down
2 changes: 1 addition & 1 deletion src/core/operations/ParseColourCode.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ CMYK: ${cmyk}
document.getElementById('input-text').value = 'rgba(' +
color.r + ', ' + color.g + ', ' + color.b + ', ' + color.a + ')';
window.app.autoBake();
});
}).children(".colorpicker").removeClass('dropdown-menu');
</script>`;
}

Expand Down
3 changes: 1 addition & 2 deletions src/core/operations/ParseDateTime.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import Operation from "../Operation";
import moment from "moment-timezone";
import {DATETIME_FORMATS, FORMAT_EXAMPLES} from "../lib/DateTime";
import OperationError from "../errors/OperationError";

/**
* Parse DateTime operation
Expand Down Expand Up @@ -60,7 +59,7 @@ class ParseDateTime extends Operation {
date = moment.tz(input, inputFormat, inputTimezone);
if (!date || date.format() === "Invalid date") throw Error;
} catch (err) {
throw new OperationError(`Invalid format.\n\n${FORMAT_EXAMPLES}`);
return `Invalid format.\n\n${FORMAT_EXAMPLES}`;
}

output += "Date: " + date.format("dddd Do MMMM YYYY") +
Expand Down
2 changes: 1 addition & 1 deletion src/core/operations/ParseIPv4Header.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class ParseIPv4Header extends Operation {
checksumResult = givenChecksum + " (incorrect, should be " + correctChecksum + ")";
}

output = `<table class='table table-hover table-condensed table-bordered table-nonfluid'><tr><th>Field</th><th>Value</th></tr>
output = `<table class='table table-hover table-sm table-bordered table-nonfluid'><tr><th>Field</th><th>Value</th></tr>
<tr><td>Version</td><td>${version}</td></tr>
<tr><td>Internet Header Length (IHL)</td><td>${ihl} (${ihl * 4} bytes)</td></tr>
<tr><td>Differentiated Services Code Point (DSCP)</td><td>${dscp}</td></tr>
Expand Down
4 changes: 2 additions & 2 deletions src/core/operations/ToTable.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -147,12 +147,12 @@ class ToTable extends Operation {
*/
function htmlOutput(tableData) {
// Start the HTML output with suitable classes for styling.
let output = "<table class='table table-hover table-condensed table-bordered table-nonfluid'>";
let output = "<table class='table table-hover table-sm table-bordered table-nonfluid'>";

// If the first row is a header then put it in <thead> with <th> cells.
if (firstRowHeader) {
const row = tableData.shift();
output += "<thead>";
output += "<thead class='thead-light'>";
output += outputRow(row, "th");
output += "</thead>";
}
Expand Down
3 changes: 1 addition & 2 deletions src/core/operations/TranslateDateTimeFormat.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import Operation from "../Operation";
import moment from "moment-timezone";
import {DATETIME_FORMATS, FORMAT_EXAMPLES} from "../lib/DateTime";
import OperationError from "../errors/OperationError";

/**
* Translate DateTime Format operation
Expand Down Expand Up @@ -68,7 +67,7 @@ class TranslateDateTimeFormat extends Operation {
date = moment.tz(input, inputFormat, inputTimezone);
if (!date || date.format() === "Invalid date") throw Error;
} catch (err) {
throw new OperationError(`Invalid format.\n\n${FORMAT_EXAMPLES}`);
return `Invalid format.\n\n${FORMAT_EXAMPLES}`;
}

return date.tz(outputTimezone).format(outputFormat);
Expand Down
Loading