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:
21
src/utils/others/jsToMsDate.js
Normal file
21
src/utils/others/jsToMsDate.js
Normal 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)); }
|
||||
|
||||
})();
|
||||
13
src/utils/others/msToJsDate.js
Normal file
13
src/utils/others/msToJsDate.js
Normal 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));
|
||||
}
|
||||
})();
|
||||
39
src/utils/others/showDebugInfo.js
Normal file
39
src/utils/others/showDebugInfo.js
Normal 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');
|
||||
})();
|
||||
Reference in New Issue
Block a user