better organization, add in eslint as well as package and other helper bookmarklets found on confluence to have here if needed as a reference

This commit is contained in:
Greg Jacobs
2024-06-01 18:12:05 -04:00
parent 21397c5827
commit 1e4c307f97
14 changed files with 132 additions and 13 deletions

View File

@@ -0,0 +1,21 @@
javascript:(function() {
function jsToMsDate(jsdate) {
var ms = Date.UTC(
jsdate.getUTCFullYear(),
jsdate.getUTCMonth(),
jsdate.getUTCDate(),
jsdate.getUTCHours(),
jsdate.getUTCMinutes(),
jsdate.getUTCSeconds(),
jsdate.getUTCMilliseconds()
);
var off = jsdate.getTimezoneOffset();
return (ms - off * 60 * 1000) / 86400000 + 25569;
}
var date = prompt("Enter date");
if (date) {
date = new Date(date);
alert(jsToMsDate(date)); }
})();

View File

@@ -0,0 +1,13 @@
javascript:(function() {
function msToJsDate(msdate) {
var jscriptDateObj = new Date(((msdate - 25569) * 86400000));
var timezoneOffset = jscriptDateObj.getTimezoneOffset();
jscriptDateObj = new Date(((msdate - 25569 + (timezoneOffset / (60 * 24))) * 86400000));
return jscriptDateObj;
}
var date = prompt("Enter MSDate");
if (date) {
alert(msToJsDate(date));
}
})();

View File

@@ -0,0 +1,39 @@
javascript: (function () {
function setFlag(_flag, _state) {
function setFlagSub(_url, _flag, _state) {
if (_url.indexOf(_flag) == -1) {
_url += (/\?/.test(_url)) ? '&' : '?';
_url += '..' + _flag + '..=' + _state;
} else {
var re = new RegExp('\\.\\.' + _flag + '\\.\\.=[^&]*');
_url = _url.replace(re, '..' + _flag + '..=' + _state);
}
return _url;
};
function toggleParameter(ad, type, val) {
type = '..' + type + '..';
if (m = ad.match(new RegExp('[?|&]' + type + '=(on|off)&?'))) {
ad = ad.replace(type + '=' + m[1], type + '=' + (val || (m[1] == 'on' ? 'off' : 'on')));
} else {
ad += (/\?/.test(ad) ? '&' : '?') + type + '=' + (val || 'on');
}
return ad;
};
var dependencies = {
'debugchartsrv': ['showdebuginfo'],
'scriptscachedebug': ['scriptscache']
};
var url = new String(window.location.href).replace(/#.*/,);
if (dependencies[_flag] && _state != 'off') {
for (var i = 0; i < dependencies[_flag].length; i++) {
url = toggleParameter(url, dependencies[_flag][i], 'on');
}
}
url = toggleParameter(url, _flag, _state || null);
window.location.href = url;
};
setFlag('showdebuginfo');
})();