mirror of
https://forge.murkfall.net/bluesaxman/blue.js.git
synced 2026-03-13 09:34:20 -06:00
some minor syntax corrections and a rewrite of the demo index.html and css file
This commit is contained in:
@@ -16,7 +16,7 @@ class buiProgressBar {
|
||||
this.progress = 0;
|
||||
}
|
||||
|
||||
function update (value,progress) {
|
||||
update (value,progress) {
|
||||
this.value = !isNaN(value) ? value : 0;
|
||||
this.progress = !isNaN(progress) ? Math.max(0,Math.min(1,progress)) : 0;
|
||||
this.lable.innerText = this.name+": "+numberShorten(this.value,4);
|
||||
@@ -26,9 +26,9 @@ class buiProgressBar {
|
||||
|
||||
class buiButton {
|
||||
constructor (name, myFunction) {
|
||||
this.root = document.createElement("span");
|
||||
this.root = document.createElement("a");
|
||||
this.lable = document.createElement("span");
|
||||
this.root.setAttribute("class","bui_button_root"+("string" == typeof name ? " "+name+"_button" : ""));
|
||||
this.root.setAttribute("class","bui_button_root"+("string" == typeof name ? " "+(name.replaceAll(" ","_"))+"_button" : ""));
|
||||
this.lable.setAttribute("class","bui_button_lable");
|
||||
this.lable.innerText = "string" == typeof name ? name : "";
|
||||
this.root.appendChild(this.lable);
|
||||
@@ -56,23 +56,23 @@ function makeDraggable (targetNode, handleNode) {
|
||||
|
||||
function stopDrag (e) {
|
||||
targetNode.class = "";
|
||||
doc.removeEventListener("mousemove",doDrag);
|
||||
doc.removeEventListener("mousemove",stopDrag);
|
||||
document.removeEventListener("mousemove",doDrag);
|
||||
document.removeEventListener("mousemove",stopDrag);
|
||||
}
|
||||
|
||||
function initDrag (e) {
|
||||
targetNode.class = "dragging";
|
||||
x_offset = e.clientX;
|
||||
y_offset = e.clientY;
|
||||
doc.addEventListener("mousemove",doDrag,false);
|
||||
doc.addEventListener("mouseup",stopDrag,false);
|
||||
document.addEventListener("mousemove",doDrag,false);
|
||||
document.addEventListener("mouseup",stopDrag,false);
|
||||
}
|
||||
}
|
||||
|
||||
function makeResizeable (targetNode, handleNode) {
|
||||
targetNode.className = targetNode.className + ' resizable';
|
||||
if (undefined == handleNode) {
|
||||
handleNode = doc.createElement('div');
|
||||
handleNode = document.createElement('div');
|
||||
handleNode.setAttribute("style","width: 10px; height: 10px; background: red; position:absolute; right: 0; bottom: 0; cursor: se-resize; z-index: 55000;");
|
||||
targetNode.appendChild(handleNode);
|
||||
}
|
||||
@@ -82,10 +82,10 @@ function makeResizeable (targetNode, handleNode) {
|
||||
function initResize(e) {
|
||||
startX = e.clientX;
|
||||
startY = e.clientY;
|
||||
startWidth = parseInt(doc.defaultView.getComputedStyle(target).width, 10);
|
||||
startHeight = parseInt(doc.defaultView.getComputedStyle(target).height, 10);
|
||||
doc.documentElement.addEventListener('mousemove', doResize, false);
|
||||
doc.documentElement.addEventListener('mouseup', stopResize, false);
|
||||
startWidth = parseInt(document.defaultView.getComputedStyle(target).width, 10);
|
||||
startHeight = parseInt(document.defaultView.getComputedStyle(target).height, 10);
|
||||
document.documentElement.addEventListener('mousemove', doResize, false);
|
||||
document.documentElement.addEventListener('mouseup', stopResize, false);
|
||||
}
|
||||
|
||||
function doResize(e) {
|
||||
@@ -94,21 +94,21 @@ function makeResizeable (targetNode, handleNode) {
|
||||
}
|
||||
|
||||
function stopResize(e) {
|
||||
doc.documentElement.removeEventListener('mousemove', doResize, false);
|
||||
doc.documentElement.removeEventListener('mouseup', stopResize, false);
|
||||
document.documentElement.removeEventListener('mousemove', doResize, false);
|
||||
document.documentElement.removeEventListener('mouseup', stopResize, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class buiWindow {
|
||||
constructor (title="", height=100, width=100, min=false, close=true, dragable=true, sizeable=true) {
|
||||
constructor (title="", height=100, width=100, min=false, close=true, draggable=true, sizeable=true) {
|
||||
this.root = document.createElement("div");
|
||||
this.root.setAttribute("class","bui_window_root");
|
||||
this.titlebar = document.createElement("div");
|
||||
this.titlebar.setAttribute("class","bui_window_titlebar");
|
||||
this.title = document.createElement("span");
|
||||
this.title.setAttribute("class","bui_window_title");
|
||||
this.title.innerText = "string" == title ? title : "";
|
||||
this.title.innerText = "string" == typeof title ? title : "";
|
||||
this.titlebar.appendChild(this.title);
|
||||
draggable = "boolean" == typeof draggable ? draggable : true;
|
||||
if (draggable) {
|
||||
@@ -145,10 +145,10 @@ class buiWindow {
|
||||
this.root.appendChild(this.content);
|
||||
}
|
||||
|
||||
function minimize () {
|
||||
minimize () {
|
||||
}
|
||||
|
||||
function close () {
|
||||
close () {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user