Move some of the util functions to util.js

This commit is contained in:
Dan Sosedoff 2017-09-16 14:03:42 -05:00
parent 81af2a9a27
commit 28b0840e69
3 changed files with 20 additions and 19 deletions

File diff suppressed because one or more lines are too long

View File

@ -4,16 +4,6 @@ var bookmarks = {};
var default_rows_limit = 100;
var currentObject = null;
if (!Array.prototype.forEach) {
// Simplified iterator for browsers without forEach support
Array.prototype.forEach = function(cb) {
if (typeof this.length != 'number') return;
if (typeof callback != 'function') return;
for (var i = 0; i < this.length; i++) cb(this[i]);
}
}
var filterOptions = {
"equal": "= 'DATA'",
"not_equal": "!= 'DATA'",
@ -27,11 +17,6 @@ var filterOptions = {
"not_null": "IS NOT NULL"
};
function guid() {
function s4() { return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); }
return [s4(), s4(), "-", s4(), "-", s4(), "-", s4(), "-", s4(), s4(), s4()].join("");
}
function getSessionId() {
var id = sessionStorage.getItem("session_id");

View File

@ -1,3 +1,13 @@
if (!Array.prototype.forEach) {
// Simplified iterator for browsers without forEach support
Array.prototype.forEach = function(cb) {
if (typeof this.length != 'number') return;
if (typeof callback != 'function') return;
for (var i = 0; i < this.length; i++) cb(this[i]);
}
}
function copyToClipboard(text) {
const element = document.createElement("textarea");
element.style.display = "none;"
@ -10,3 +20,9 @@ function copyToClipboard(text) {
document.execCommand("copy");
document.body.removeChild(element);
}
function guid() {
function s4() { return Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1); }
return [s4(), s4(), "-", s4(), "-", s4(), "-", s4(), "-", s4(), s4(), s4()].join("");
}