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

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
package-lock.json
node_modules/

View File

@@ -5,12 +5,15 @@ All notable changes to this project will be documented in this file.
## [0.0.1] - 2025-06-01
### Added
- [helpers/dag.js](src/helpers/dag.js)
- [helpers/hashid.js](src/helpers/hashid.js)
- [helpers/jira.js](src/helpers/jira.js)
- [helpers/moids.js](src/helpers/moids.js)
- [helpers/rbc-di-featureflags.js](src/helpers/rbc-di-featureflags.js)
- [helpers/workspace.js](src/helpers/workspace.js)
- [utils/bookmarklets/dag.js](src/utils/bookmarklets/dag.js)
- [utils/bookmarklets/hashid.js](src/utils/bookmarklets/hashid.js)
- [utils/bookmarklets/jira.js](src/utils/bookmarklets/jira.js)
- [utils/bookmarklets/moids.js](src/utils/bookmarklets/moids.js)
- [utils/bookmarklets/rbc-di-featureflags.js](src/utils/bookmarklets/rbc-di-featureflags.js)
- [utils/bookmarklets/workspace.js](src/utils/bookmarklets/workspace.js)
- [utils/others/jsToMsDate.js](src/utils/others/jsToMsDate.js)
- [utils/others/msToJsDate.js](src/utils/others/msToJsDate.js)
- [utils/others/showDebugInfo.js](src/utils/others/showDebugInfo.js)
- [ideas/newideashere.txt](src/ideas/newideashere.txt)
- [ideas/released/featureflagging.txt](src/ideas/released/featureflagging.txt)
- [data folder](src/data)

View File

@@ -2,26 +2,38 @@
This project contains several files that perform various tasks. Here's a brief overview of each file:
## [DAG](src/helpers/dag.js)
## [DAG](src/utils/bookmarklets/dag.js)
This JavaScript file contains a bookmarklet function that prompts the user for a list of DAG Task numbers, separated by commas. For each provided number, it opens a new browser tab with the corresponding DAG Task details page. If the user doesn't provide any input, it opens the default DAG Tasks page in a new tab. This can be useful for quickly accessing multiple DAG Task details pages based on user input.
## [hashid](src/helpers/hashid.js)
## [hashid](src/utils/bookmarklets/hashid.js)
This JavaScript file contains a bookmarklet function that takes a string, decodes it using decodeURIComponent, alerts the decoded string, and copies the result to the clipboard.
## [jira.js](src/helpers/jira.js)
## [jira.js](src/utils/bookmarklets/jira.js)
This JavaScript file contains a bookmarklet function that prompts the user for a JIRA ticket number and then opens a new browser tab with the corresponding JIRA page for that ticket.
## [moids.js](src/helpers/moids.js)
## [moids.js](src/utils/bookmarklets/moids.js)
This JavaScript file contains a bookmarklet function that prompts the user for multiple MOID (Markit On Demand) numbers and then opens a new browser tab for each corresponding Jira page for those MOIDs.
## [rbc-di-featureflag.js](src/helpers/rbc-di-featureflags.js)
## [rbc-di-featureflag.js](src/utils/bookmarklets/rbc-di-featureflags.js)
This JavaScript file contains a bookmarklet function that checks the feature flags set in the session storage and displays themm as checkboxes that the user can set then save
## [Workspace - WIP](src/helpers/workspace.js)
## [Workspace - WIP](src/utils/bookmarklets/workspace.js)
This is just so i can get up and running on a new window with all the pages i care about
## [jsToMsDate.js](src/utils/others/jsToMsDate.js)
This JavaScript file contains a function that converts a JavaScript Date object to a Microsoft Date string format. It can be useful when working with APIs or databases that require dates to be in the Microsoft Date format.
## [msToJsDate.js](src/utils/others/msToJsDate.js)
This JavaScript file contains a function that converts a Microsoft Date string format to a JavaScript Date object. It can be useful when working with APIs or databases that provide dates in the Microsoft Date format.
## [showDebugInfo.js](src/utils/others/showDebugInfo.js)
This JavaScript file contains a bookmarklet function that displays debug information about the current page. It can be useful for troubleshooting and understanding the state of the page during development.

8
eslint.config.mjs Normal file
View File

@@ -0,0 +1,8 @@
import globals from "globals";
import pluginJs from "@eslint/js";
export default [
{languageOptions: { globals: {...globals.browser, ...globals.node} }},
pluginJs.configs.recommended,
];

21
package.json Normal file
View File

@@ -0,0 +1,21 @@
{
"name": "memorypalace",
"version": "0.0.1",
"description": "This project contains several files that perform various tasks. Here's a brief overview of each file:",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://stash.mgmt.local/users/greg.jacobs/repos/memorypalace/browse"
},
"author": "Greg Jacobs",
"license": "ISC",
"devDependencies": {
"@eslint/js": "^9.4.0",
"eslint": "^9.4.0",
"globals": "^15.3.0",
"prettier": "^3.3.0"
}
}

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');
})();