Compare commits
No commits in common. "24a7f2c9375778f1342101e7256da87c67311f12" and "56d28046269c79d73c31520bcb1263e1888181f0" have entirely different histories.
24a7f2c937
...
56d2804626
17
Dockerfile
17
Dockerfile
@ -1,17 +0,0 @@
|
||||
### STAGE 1: build ###
|
||||
FROM golang:1.18-alpine AS build
|
||||
WORKDIR /usr/app
|
||||
COPY . .
|
||||
RUN go build .
|
||||
RUN ls -a
|
||||
|
||||
### STAGE 2: Run ###
|
||||
FROM golang:1.18-alpine
|
||||
WORKDIR /usr/app
|
||||
COPY --from=build /usr/app/personalwebsite /usr/app/personalwebsite
|
||||
COPY ./templates /usr/app/templates
|
||||
COPY ./resources /usr/app/resources
|
||||
|
||||
EXPOSE 8080
|
||||
|
||||
CMD [ "/usr/app/personalwebsite" ]
|
1
main.go
1
main.go
@ -28,6 +28,7 @@ import (
|
||||
// }
|
||||
|
||||
func main() {
|
||||
// hostUrl := "http://localhost:8080/"
|
||||
router := gin.New()
|
||||
|
||||
router.LoadHTMLGlob("templates/**/*")
|
||||
|
@ -17,9 +17,6 @@
|
||||
}
|
||||
|
||||
body{
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0px;
|
||||
/* font: normal 14px Summer Pixel 22, "res/SummerPixel22Regular.ttf"; */
|
||||
-webkit-touch-callout: none; /* iOS Safari */
|
||||
|
@ -11,7 +11,7 @@ class Finder{
|
||||
|
||||
Init(){
|
||||
console.log("Init")
|
||||
fetch(`${window.location.origin}/application/${this.appId}/render`) //TODO Move to wde func
|
||||
fetch(`http://localhost:8080/application/${this.appId}/render`) //TODO Move to wde func
|
||||
.then((response) => response.text())
|
||||
.then((html) => {
|
||||
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, "Finder", 600, 500)
|
||||
|
@ -12,18 +12,28 @@ class PersonalProperties{
|
||||
|
||||
Init(){
|
||||
console.log("Init")
|
||||
fetch(`${window.location.origin}/application/personal-properties/render`) //TODO Move to wde func. Or Not?
|
||||
fetch("http://localhost:8080/application/personal-properties/render") //TODO Move to wde func
|
||||
.then((response) => response.text())
|
||||
.then((html) => {
|
||||
// console.log(document.body)
|
||||
// let heigth = Math.max(document.body.clientHeight*0.8, scrollDiv.children[0].scrollHeight) //TODO
|
||||
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, "Personal Properties", 360, document.body.clientHeight*0.8 )
|
||||
//TODO Get ~70% of user screen height
|
||||
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, "Personal Properties", 300, 500)
|
||||
|
||||
newWindow.innerHTML = html
|
||||
|
||||
let closeButton = newWindow.children[0].children[0]
|
||||
let scrollDiv = newWindow.children[1]
|
||||
let scrollBar = new WdeScrollBar(scrollDiv.children[1].children[0], scrollDiv.children[0])
|
||||
// console.log(scrollDiv)
|
||||
let scrollBar = new WdeScrollBar(scrollDiv.children[1].children[0])
|
||||
console.log(scrollBar)
|
||||
|
||||
// scrollBar.BindHandler(scrollDiv.children[1].children[0])
|
||||
// scrollBar.BindHandler(scrollDiv.children[1].children[0])
|
||||
|
||||
// SimpleScrollbar.initEl(scrollDiv)
|
||||
|
||||
// console.log("SimpleBar" + SimpleScrollbar)
|
||||
|
||||
// SimpleScrollbar.initAll();
|
||||
|
||||
closeButton.addEventListener('click', function (params) {
|
||||
WebDesktopEnvironment.CloseWindow(newWindow)
|
||||
@ -33,4 +43,13 @@ class PersonalProperties{
|
||||
WebDesktopEnvironment.Alert(error);
|
||||
});
|
||||
}
|
||||
|
||||
CloseWindow(id){
|
||||
console.log(id+"Close")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function reply_click(){
|
||||
console.log("QQQQQQQQQQQQQQQQQQQ")
|
||||
}
|
@ -1,49 +1,83 @@
|
||||
class WdeScrollBar{
|
||||
// max = 0
|
||||
// isDragged = false
|
||||
/**
|
||||
* @param {HTMLElement} handler
|
||||
* @param {HTMLElement} content
|
||||
*/
|
||||
constructor(handler, content){
|
||||
let nonNativeScroll = false
|
||||
|
||||
handler.style.height = (content.clientHeight /content.scrollHeight)* handler.parentElement.clientHeight + 'px'
|
||||
|
||||
constructor(handler){
|
||||
console.log( handler.clientHeight)
|
||||
let max = handler.parentElement.clientHeight - handler.clientHeight
|
||||
let yOffset = null
|
||||
let yPosInit = 0
|
||||
|
||||
handler.addEventListener('mousedown', (event) => {
|
||||
nonNativeScroll = true
|
||||
// yOffset = event.offsetY
|
||||
yPosInit = event.clientY - Number(handler.style.top.replace('px','' ))
|
||||
|
||||
|
||||
|
||||
// console.log()
|
||||
document.addEventListener('mousemove', drag);
|
||||
document.addEventListener('mouseup', stop)
|
||||
})
|
||||
|
||||
content.addEventListener('scroll', (event) =>{
|
||||
if (!this.nonNativeScroll){
|
||||
let handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight //TODO recalculate only on resize event
|
||||
let coefficient = (content.scrollHeight - content.clientHeight) /handlerPathLength
|
||||
handler.style.top = content.scrollTop/coefficient + 'px'
|
||||
}
|
||||
//TODO Document dissallow select
|
||||
})
|
||||
|
||||
function drag() {
|
||||
// console.log(event.clientY - yPosInit, Number(handler.style.top.replace('px','' )))
|
||||
|
||||
console.log(event.clientY - yPosInit, Number(handler.style.top.replace('px','' )))
|
||||
|
||||
let pos = event.clientY - yPosInit
|
||||
let clampPos = Math.min(Math.max(pos, 0), max)
|
||||
handler.style.top = clampPos + "px";
|
||||
|
||||
let handlerPathLength = handler.parentElement.clientHeight - handler.clientHeight //TODO recalculate only on resize event
|
||||
let coefficient = (content.scrollHeight - content.clientHeight) /handlerPathLength
|
||||
// console.log(clampPos, coefficient, content.clientHeight, clampPos* coefficient)
|
||||
|
||||
content.scrollTop = clampPos* coefficient
|
||||
// let yPos = Number(handler.style.top.replace('px', 0))
|
||||
// console.log(event)
|
||||
// console.log(yOffset)
|
||||
// console.log(event.movementY)
|
||||
|
||||
// let pos = event.clientY - handler.clientHeight
|
||||
|
||||
|
||||
// console.log(pos)
|
||||
// let pos2 = yPos + event.movementY
|
||||
// console.log(event.clientY - yPosInit)
|
||||
// console.log(event.offsetY)
|
||||
// yPos += event.yOffset
|
||||
// handler.style.top = event.clientY - yPosInit + 'px'
|
||||
// console.log(handler.Y)
|
||||
// let pos = yPosInit - event.clientY
|
||||
// let newPos = Math.min(Math.max(pos, 0), max)
|
||||
// console.log(handler.style.top , event.offsetY)
|
||||
// handler.style.top = event.clientY+ "px";
|
||||
}
|
||||
|
||||
function stop() {
|
||||
// console.log("stop")
|
||||
console.log("stop")
|
||||
document.removeEventListener('mousemove', drag);
|
||||
document.removeEventListener('mouseup', stop)
|
||||
nonNativeScroll = false
|
||||
}
|
||||
}
|
||||
// /**
|
||||
// * @param {HTMLElement} element
|
||||
// */
|
||||
// BindHandler(element) {
|
||||
// element.addEventListener('mousedown', (event) => {
|
||||
// this.isDragged =
|
||||
// element.addEventListener('mouseup', this.stop);
|
||||
// });
|
||||
// element.removeEventListener
|
||||
// }
|
||||
|
||||
// drag(){
|
||||
|
||||
// }
|
||||
// stop(doc){
|
||||
// console.log("stop")
|
||||
// doc.removeEventListener('mouseup', (event) => {
|
||||
// this.stop(document)
|
||||
// });
|
||||
// }
|
||||
// MoveHandler(param) {
|
||||
// console.log("Move")
|
||||
// }
|
||||
}
|
@ -4,11 +4,10 @@ document.addEventListener('DOMContentLoaded', function() {
|
||||
|
||||
class WebDesktopEnvironment{
|
||||
constructor(){
|
||||
// console.log(window)
|
||||
this.wc = new WindowsCompositor
|
||||
|
||||
//Get basic window ready frame
|
||||
fetch(`${window.location.origin}/system/wde/getbasicwindow`) //TODO Move to wde func
|
||||
fetch("http://localhost:8080/system/wde/getbasicwindow") //TODO Move to wde func
|
||||
.then((response) => response.text())
|
||||
.then((html) => {
|
||||
WebDesktopEnvironment.SetBasicWindow(html)
|
||||
@ -32,7 +31,7 @@ class WebDesktopEnvironment{
|
||||
|
||||
|
||||
let script = document.createElement("script")
|
||||
script.setAttribute("src", `${window.location.origin}/system/applications/${appId}/app.js`)
|
||||
script.setAttribute("src", `http://localhost:8080/system/applications/${appId}/app.js`)
|
||||
script.setAttribute("async", "false")
|
||||
appElem.appendChild(script)
|
||||
script.addEventListener("load", function () {
|
||||
@ -93,7 +92,6 @@ class WebDesktopEnvironment{
|
||||
static Alert(alertText){
|
||||
console.log(alertText)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
var getJSON = function(url, callback) {
|
||||
|
Loading…
Reference in New Issue
Block a user