Skip to content

Commit e5dd501

Browse files
authored
Add files via upload
1 parent cbe08db commit e5dd501

File tree

1 file changed

+178
-0
lines changed

1 file changed

+178
-0
lines changed

worktime.html

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
<!DOCTYPE html><html><head><style>html {
2+
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif;
3+
}
4+
5+
.title {
6+
font-size: 3rem;
7+
color: lightskyblue;
8+
}
9+
10+
#root {
11+
border-radius: 1rem;
12+
padding: 1rem;
13+
}
14+
15+
a {
16+
color: grey;
17+
}
18+
19+
@keyframes shake {
20+
0% {
21+
transform: translate(-1px, -1px);
22+
}
23+
5% {
24+
transform: translate(1px, 1px);
25+
}
26+
10% {
27+
transform: translate(-1px, -1px);
28+
}
29+
15% {
30+
transform: translate(1px, 1px);
31+
}
32+
20% {
33+
transform: translate(0px, 0px);
34+
}
35+
}</style>
36+
<script>var __VAR_JSON__ = {
37+
"name": "o(*≧▽≦)ツ┏━┓",
38+
"dependencies": {
39+
"react": "https://cdn.jsdelivr.net/npm/react/umd/react.production.min.js",
40+
"react-dom": "https://cdn.jsdelivr.net/npm/react-dom/umd/react-dom.production.min.js",
41+
"axios": "https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js",
42+
"moment": "https://cdn.jsdelivr.net/npm/moment/moment.js",
43+
"antd": "https://cdn.jsdelivr.net/npm/antd@4.24.4/dist/antd.min.js",
44+
"@ant-design/icons": "https://cdn.jsdelivr.net/npm/@ant-design/icons/dist/index.umd.js"
45+
},
46+
"types": {
47+
"react": "https://cdn.jsdelivr.net/npm/@types/react/index.d.ts",
48+
"react-dom": "https://cdn.jsdelivr.net/npm/@types/react-dom/index.d.ts",
49+
"csstype": "https://cdn.jsdelivr.net/npm/csstype/index.d.ts",
50+
"prop-types": "https://cdn.jsdelivr.net/npm/@types/prop-types/index.d.ts",
51+
"axios": "https://cdn.jsdelivr.net/npm/axios/index.d.ts",
52+
"moment": "https://cdn.jsdelivr.net/npm/moment/moment.d.ts",
53+
"global:antd": "https://cdn.jsdelivr.net/gh/saber2pr/antd-types-bundle@gh-pages/antd.d.ts",
54+
"@ant-design/icons": "https://cdn.jsdelivr.net/npm/@ant-design/icons/lib/icons/index.d.ts"
55+
}
56+
}
57+
;</script>
58+
<!-- for typescript target: AMD -->
59+
<script src="https://cdn.jsdelivr.net/gh/requirejs/requirejs/require.js"></script>
60+
61+
<!-- antd stylesheet -->
62+
<link href="https://cdn.jsdelivr.net/npm/antd/dist/antd.min.css" rel="stylesheet">
63+
64+
</head><body><div id="root"></div>
65+
66+
<script>;(function(){
67+
// 1. config requirejs
68+
const packages = __VAR_JSON__.dependencies
69+
const oldLoad = requirejs.load
70+
requirejs.load = function (context, id, url) {
71+
if (id in packages) {
72+
url = packages[id]
73+
}
74+
return oldLoad.call(requirejs, context, id, url)
75+
}
76+
77+
// 2. declarations config
78+
// please remove it before sandbox exports.
79+
// api docs:https://github.com/Saber2pr/editor/blob/master/docs/script.md
80+
if (top !== self) {
81+
if (!top._finished) {
82+
top.LOADING.init()
83+
const typescriptVersion = top.monaco.languages.typescript.typescriptVersion
84+
console.log(`[<span style="color:blue;">Typescript Version:${typescriptVersion}</span>]`)
85+
console.log('--- wait for types fetching... ---')
86+
const info = m => `<span style="background:lightskyblue">${m}</span>`
87+
const types = __VAR_JSON__.types
88+
const names = Object.keys(types)
89+
const count = names.length
90+
let index = 0
91+
Promise.all(names.map(name => top.api_addModuleDeclaration(types[name], name.startsWith('global:') ? null : name)
92+
.then(() =>
93+
console.log(`type(${++index}/${count}): ${info(`[${name}]`)} fetched`))))
94+
.then(() => {
95+
console.log(`--- types fetching finished. ---`)
96+
top.LOADING.destroy()
97+
})
98+
top._finished = true
99+
}
100+
}
101+
102+
// 3. enjoy it!
103+
console.log(__VAR_JSON__.name, new Date().toLocaleString())
104+
105+
})();</script><script>var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
106+
if (k2 === undefined) k2 = k;
107+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
108+
}) : (function(o, m, k, k2) {
109+
if (k2 === undefined) k2 = k;
110+
o[k2] = m[k];
111+
}));
112+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
113+
Object.defineProperty(o, "default", { enumerable: true, value: v });
114+
}) : function(o, v) {
115+
o["default"] = v;
116+
});
117+
var __importStar = (this && this.__importStar) || function (mod) {
118+
if (mod && mod.__esModule) return mod;
119+
var result = {};
120+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
121+
__setModuleDefault(result, mod);
122+
return result;
123+
};
124+
var __read = (this && this.__read) || function (o, n) {
125+
var m = typeof Symbol === "function" && o[Symbol.iterator];
126+
if (!m) return o;
127+
var i = m.call(o), r, ar = [], e;
128+
try {
129+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
130+
}
131+
catch (error) { e = { error: error }; }
132+
finally {
133+
try {
134+
if (r && !r.done && (m = i["return"])) m.call(i);
135+
}
136+
finally { if (e) throw e.error; }
137+
}
138+
return ar;
139+
};
140+
var __importDefault = (this && this.__importDefault) || function (mod) {
141+
return (mod && mod.__esModule) ? mod : { "default": mod };
142+
};
143+
define("index",["require", "exports", "react-dom", "react", "moment"], function (require, exports, react_dom_1, react_1, moment_1) {
144+
"use strict";
145+
Object.defineProperty(exports, "__esModule", { value: true });
146+
react_dom_1 = __importDefault(react_dom_1);
147+
react_1 = __importStar(react_1);
148+
moment_1 = __importDefault(moment_1);
149+
var mountNode = document.getElementById('root');
150+
var App = function (_a) {
151+
var github = _a.github;
152+
var _b = __read(react_1.useState(0), 2), state = _b[0], setState = _b[1];
153+
react_1.useEffect(function () {
154+
setState(+localStorage.getItem('work_start_time'));
155+
}, []);
156+
var dur = moment_1.default.duration(moment_1.default().diff(moment_1.default(state)));
157+
return react_1.default.createElement("div", null,
158+
react_1.default.createElement("button", { onClick: function () {
159+
var settime = confirm('设置开始时间?');
160+
if (!settime)
161+
return;
162+
var time = Date.now();
163+
localStorage.setItem('work_start_time', String(time));
164+
setState(time);
165+
} }, "\u8BBE\u7F6E\u5F00\u59CB\u65F6\u95F4"),
166+
react_1.default.createElement("div", null,
167+
"\u5F00\u59CB\u65F6\u95F4\uFF1A",
168+
moment_1.default(state).format('YYYYMMDD HH:mm:ss')),
169+
react_1.default.createElement("div", null,
170+
"\u5DF2\u5DE5\u4F5C\u65F6\u957F\uFF1A",
171+
dur.hours(),
172+
"\u5C0F\u65F6",
173+
dur.minutes(),
174+
"\u5206\u949F"));
175+
};
176+
react_dom_1.default.render(react_1.default.createElement(App, { github: "https://github.com/Saber2pr/editor" }), mountNode);
177+
});
178+
;require(["index"])</script></body></html>

0 commit comments

Comments
 (0)