Compare commits

..

No commits in common. "24a7f2c9375778f1342101e7256da87c67311f12" and "56d28046269c79d73c31520bcb1263e1888181f0" have entirely different histories.

7 changed files with 85 additions and 53 deletions

View File

@ -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" ]

View File

@ -28,6 +28,7 @@ import (
// } // }
func main() { func main() {
// hostUrl := "http://localhost:8080/"
router := gin.New() router := gin.New()
router.LoadHTMLGlob("templates/**/*") router.LoadHTMLGlob("templates/**/*")

View File

@ -17,9 +17,6 @@
} }
body{ body{
position: absolute;
width: 100%;
height: 100%;
margin: 0px; margin: 0px;
/* font: normal 14px Summer Pixel 22, "res/SummerPixel22Regular.ttf"; */ /* font: normal 14px Summer Pixel 22, "res/SummerPixel22Regular.ttf"; */
-webkit-touch-callout: none; /* iOS Safari */ -webkit-touch-callout: none; /* iOS Safari */

View File

@ -11,7 +11,7 @@ class Finder{
Init(){ Init(){
console.log("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((response) => response.text())
.then((html) => { .then((html) => {
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, "Finder", 600, 500) let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, "Finder", 600, 500)

View File

@ -12,18 +12,28 @@ class PersonalProperties{
Init(){ Init(){
console.log("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((response) => response.text())
.then((html) => { .then((html) => {
// console.log(document.body) //TODO Get ~70% of user screen height
// let heigth = Math.max(document.body.clientHeight*0.8, scrollDiv.children[0].scrollHeight) //TODO let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, "Personal Properties", 300, 500)
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, "Personal Properties", 360, document.body.clientHeight*0.8 )
newWindow.innerHTML = html newWindow.innerHTML = html
let closeButton = newWindow.children[0].children[0] let closeButton = newWindow.children[0].children[0]
let scrollDiv = newWindow.children[1] 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) { closeButton.addEventListener('click', function (params) {
WebDesktopEnvironment.CloseWindow(newWindow) WebDesktopEnvironment.CloseWindow(newWindow)
@ -33,4 +43,13 @@ class PersonalProperties{
WebDesktopEnvironment.Alert(error); WebDesktopEnvironment.Alert(error);
}); });
} }
CloseWindow(id){
console.log(id+"Close")
}
}
function reply_click(){
console.log("QQQQQQQQQQQQQQQQQQQ")
} }

View File

@ -1,49 +1,83 @@
class WdeScrollBar{ class WdeScrollBar{
// max = 0
// isDragged = false
/** /**
* @param {HTMLElement} handler * @param {HTMLElement} handler
* @param {HTMLElement} content
*/ */
constructor(handler, content){ constructor(handler){
let nonNativeScroll = false console.log( handler.clientHeight)
handler.style.height = (content.clientHeight /content.scrollHeight)* handler.parentElement.clientHeight + 'px'
let max = handler.parentElement.clientHeight - handler.clientHeight let max = handler.parentElement.clientHeight - handler.clientHeight
let yOffset = null
let yPosInit = 0 let yPosInit = 0
handler.addEventListener('mousedown', (event) => { handler.addEventListener('mousedown', (event) => {
nonNativeScroll = true // yOffset = event.offsetY
yPosInit = event.clientY - Number(handler.style.top.replace('px','' )) yPosInit = event.clientY - Number(handler.style.top.replace('px','' ))
// console.log()
document.addEventListener('mousemove', drag); document.addEventListener('mousemove', drag);
document.addEventListener('mouseup', stop) document.addEventListener('mouseup', stop)
}) //TODO Document dissallow select
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'
}
}) })
function drag() { 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 pos = event.clientY - yPosInit
let clampPos = Math.min(Math.max(pos, 0), max) let clampPos = Math.min(Math.max(pos, 0), max)
handler.style.top = clampPos + "px"; 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() { function stop() {
// console.log("stop") console.log("stop")
document.removeEventListener('mousemove', drag); document.removeEventListener('mousemove', drag);
document.removeEventListener('mouseup', stop) 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")
// }
} }

View File

@ -4,11 +4,10 @@ document.addEventListener('DOMContentLoaded', function() {
class WebDesktopEnvironment{ class WebDesktopEnvironment{
constructor(){ constructor(){
// console.log(window)
this.wc = new WindowsCompositor this.wc = new WindowsCompositor
//Get basic window ready frame //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((response) => response.text())
.then((html) => { .then((html) => {
WebDesktopEnvironment.SetBasicWindow(html) WebDesktopEnvironment.SetBasicWindow(html)
@ -32,7 +31,7 @@ class WebDesktopEnvironment{
let script = document.createElement("script") 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") script.setAttribute("async", "false")
appElem.appendChild(script) appElem.appendChild(script)
script.addEventListener("load", function () { script.addEventListener("load", function () {
@ -93,7 +92,6 @@ class WebDesktopEnvironment{
static Alert(alertText){ static Alert(alertText){
console.log(alertText) console.log(alertText)
} }
} }
var getJSON = function(url, callback) { var getJSON = function(url, callback) {