-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
4,210 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,129 @@ | ||
.center { | ||
text-align: center; | ||
} | ||
|
||
.left { | ||
text-align: left; | ||
} | ||
|
||
.right { | ||
text-align: right; | ||
} | ||
|
||
.help { | ||
background-color: #fafafa; | ||
border: 1px solid black; | ||
width: 80%; | ||
padding: 3px; | ||
font-size: 10pt; | ||
} | ||
|
||
.error { | ||
color: red; | ||
font-weight: bold; | ||
background-color: black; | ||
} | ||
|
||
.warning { | ||
color: yellow; | ||
font-weight: bold; | ||
background-color: black; | ||
} | ||
|
||
.success, #success { | ||
background-color: #00FF00; | ||
} | ||
|
||
.status-message { | ||
font-size: 120%; | ||
background-color: #ADD8E6; | ||
} | ||
|
||
.hard-violation { | ||
background-color: red; | ||
} | ||
|
||
.soft-violation { | ||
background-color: yellow; | ||
} | ||
|
||
.bold { | ||
font-weight: bold; | ||
} | ||
|
||
.truncate { | ||
max-width: 1px; | ||
white-space: nowrap; | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
} | ||
|
||
/* use div tags for tables */ | ||
.rTable { | ||
display: table; | ||
width: 100%; | ||
} | ||
|
||
.rTableRow { | ||
display: table-row; | ||
} | ||
|
||
.rTableHeading { | ||
display: table-header-group; | ||
background-color: #ddd; | ||
} | ||
|
||
.rTableCell, .rTableHead { | ||
display: table-cell; | ||
padding: 3px 10px; | ||
border: 1px solid #999999; | ||
} | ||
|
||
.rTableHeading { | ||
display: table-header-group; | ||
background-color: #ddd; | ||
font-weight: bold; | ||
} | ||
|
||
.rTableFoot { | ||
display: table-footer-group; | ||
font-weight: bold; | ||
background-color: #ddd; | ||
} | ||
|
||
.rTableBody { | ||
display: table-row-group; | ||
} | ||
/* end table tags */ | ||
.no-close .ui-dialog-titlebar-close { | ||
display: none; | ||
} | ||
|
||
.wide { | ||
display: block; | ||
text-decoration: none; | ||
padding: 10px; | ||
margin: 4px; | ||
border: 1px solid #ddd; | ||
} | ||
|
||
a.wide:hover, div.wide:hover, label.wide:hover { | ||
background-color: #ddd; | ||
} | ||
|
||
a.wide:visited, a.wide:link { | ||
color: inherit; | ||
} | ||
|
||
.full-width { | ||
width: 100%; | ||
box-sizing: border-box; | ||
} | ||
|
||
li.no-marker { | ||
list-style-type: none; | ||
} | ||
|
||
.right-align { | ||
float: right; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,185 @@ | ||
"use strict"; | ||
|
||
/** | ||
* Log the console if it's available. | ||
* | ||
* @param str | ||
* the message to log | ||
*/ | ||
function _log(str) { | ||
if (typeof (console) != 'undefined') { | ||
console.log(str); | ||
} | ||
} | ||
|
||
/** | ||
* Remove obj from the array ar. Uses identify equals (===). | ||
* | ||
* @param ar | ||
* the array (modified) | ||
* @param obj | ||
* the object to remove | ||
*/ | ||
function removeFromArray(ar, obj) { | ||
for (var i = 0; i < ar.length; i++) { | ||
if (ar[i] === obj) { | ||
ar.splice(i, 1); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Determine if using TLS or not. Returns "wss:" or "ws:". | ||
*/ | ||
function getWebsocketProtocol() { | ||
if ("https:" == document.location.protocol) { | ||
return "wss:"; | ||
} else { | ||
return "ws:"; | ||
} | ||
} | ||
|
||
/** | ||
* Check if a string is empty, null or undefined. | ||
*/ | ||
function isBlank(str) { | ||
return (!str || /^\s*$/.test(str)); | ||
} | ||
|
||
/** | ||
* Return a promise that on success passes along the JSON from the response and rejects on an invalid HTTP response. | ||
*/ | ||
function checkJsonResponse(response) { | ||
if (!response.ok) { | ||
throw new Error(`HTTP error! status: ${response.status}`); | ||
} | ||
return response.json(); | ||
} | ||
|
||
/** | ||
* Remove all children from an element. | ||
*/ | ||
function removeChildren(element) { | ||
while (element.firstChild) { | ||
element.removeChild(element.lastChild); | ||
} | ||
} | ||
|
||
|
||
/** | ||
* Insert text at the caret position in a text area. | ||
* | ||
* @param area the text area element | ||
* @param text the text to insert | ||
*/ | ||
function insertAtCaret(area, text) { | ||
var scrollPos = area.scrollTop; | ||
var strPos = 0; | ||
var br = ((area.selectionStart || area.selectionStart == '0') ? "ff" : (document.selection ? "ie" : false)); | ||
if (br == "ie") { | ||
area.focus(); | ||
var range = document.selection.createRange(); | ||
range.moveStart('character', -(area.value.length)); | ||
strPos = range.text.length; | ||
} else if (br == "ff") { | ||
strPos = area.selectionStart; | ||
} | ||
|
||
var front = (area.value).substring(0, strPos); | ||
var back = (area.value).substring(strPos, area.value.length); | ||
area.value = front + text + back; | ||
strPos = strPos + text.length; | ||
if (br == "ie") { | ||
area.focus(); | ||
var range = document.selection.createRange(); | ||
range.moveStart('character', -(area.value.length)); | ||
range.moveStart('character', strPos); | ||
range.moveEnd('character', 0); | ||
range.select(); | ||
} else if (br == "ff") { | ||
area.selectionStart = strPos; | ||
area.selectionEnd = strPos; | ||
area.focus(); | ||
} | ||
area.scrollTop = scrollPos; | ||
} | ||
|
||
|
||
/** | ||
* @param element check if this element is visble based on scroll | ||
* @return true if the element is visible | ||
*/ | ||
function elementIsVisible(element) { | ||
const bounding = element.getBoundingClientRect(); | ||
return bounding.top >= 0 && | ||
bounding.left >= 0 && | ||
bounding.right <= (window.innerWidth || document.documentElement.clientWidth) && | ||
bounding.bottom <= (window.innerHeight || document.documentElement.clientHeight); | ||
} | ||
|
||
/** | ||
* @return true if val is a number | ||
*/ | ||
function isNumeric(val) { | ||
return Number(parseFloat(val)) === val; | ||
} | ||
|
||
/** | ||
* Compute the height of an element including the margins. | ||
*/ | ||
function computeHeight(element) { | ||
const styles = window.getComputedStyle(element); | ||
const margin = parseFloat(styles['marginTop']) + parseFloat(styles['marginBottom']); | ||
const height = element.offsetHeight + margin; | ||
return height; | ||
} | ||
|
||
/** | ||
* Open the link in a new window without any browser buttons. Will fall back to standard link | ||
* opening if the popup is blocked. The window will attempt to be maximized and put in the top left of the screen. | ||
* | ||
* @param link an anchor DOM object | ||
*/ | ||
function openMinimalBrowser(link) { | ||
const w = window.open(link.href, | ||
link.target || "_blank", | ||
'menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=no,dependent,left=0,top=0,fullscreen=yes'); | ||
if (w) { | ||
w.moveTo(0, 0); | ||
if (w.outerWidth < screen.availWidth || w.outerHeight < screen.availHeight) { | ||
w.resizeTo(screen.availWidth, screen.availHeight); | ||
} | ||
} | ||
return w ? false : true; // allow the link to work if popup is blocked | ||
} | ||
|
||
/** | ||
* Generates [index, value] from iterable. | ||
* Based on code from https://stackoverflow.com/questions/10179815/get-loop-counter-index-using-for-of-syntax-in-javascript | ||
*/ | ||
function* enumerate(iterable) { | ||
let i = 0; | ||
for (const x of iterable) { | ||
yield [i, x]; | ||
++i; | ||
} | ||
} | ||
|
||
/** | ||
* Parse a boolean from a string. Matches Java's Boolean.parseBoolean(). | ||
*/ | ||
function parseBoolean(str) { | ||
return /^true$/i.test(str); | ||
} | ||
|
||
/** | ||
* If value matches an option in select, select it, otherwise do nothing. | ||
*/ | ||
function setSelectValue(select, value) { | ||
for(const option of select.options) { | ||
if(option.value == value) { | ||
select.value = option.value; | ||
return; | ||
} | ||
} | ||
} |
Oops, something went wrong.