Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Andeloth committed Jan 23, 2024
2 parents 5ef135f + 79cbde6 commit 95e976a
Show file tree
Hide file tree
Showing 8 changed files with 212 additions and 50 deletions.
8 changes: 8 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 10 additions & 0 deletions .idea/Camacho.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

76 changes: 58 additions & 18 deletions book/chattutor_setup/chattutor.min.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,78 @@
var global_movex = 0;
var global_movey = 0;
var should_move = true
function setupEmbedMode_URL() {

var reader = new FileReader();
const charttutor_embed_elemment_andu = document.createElement("div")
// charttutor_embed_elemment_andu.setAttribute("style", "position: fixed; z-index: 2147483646;")
// charttutor_embed_elemment_andu.innerHTML = `<div class="allchattutor">${chattutor_embed}</div>`
// document.body.append(charttutor_embed_elemment_andu)
// const container = document.getElementById("idallchattutor");
// const movecontainer = document.getElementById("moveidallchattutor");
//
// function onMouseDrag(e) {
// e.preventDefault()
// const movementX = e.movementX
// const movementY = e.movementY
// global_movex += movementX;
// global_movey += movementY;
// movecontainer.style.transition = "none"
// movecontainer.style.animation = "none"
//
// movecontainer.style.transform = `translate(${global_movex}px, ${global_movey}px)`;
// // container.style.backgroundColor = `red`;
// // console.log(container.style.transform)
// // console.log(container.style.backgroundColor)
// // console.log("hehehe", movementX, movementY)
// }
//
// container.addEventListener("mousedown", () => {
// document.addEventListener("mousemove", onMouseDrag);
// });
// document.addEventListener("mouseup", () => {
// document.removeEventListener("mousemove", onMouseDrag);
// });
charttutor_embed_elemment_andu.setAttribute("style", "position: fixed; z-index: 2147483646;")
charttutor_embed_elemment_andu.innerHTML = `<div class="allchattutor">${chattutor_embed}</div>`
charttutor_embed_elemment_andu.innerHTML = `<div class="allchattutor" id="move-andu">${chattutor_embed}</div>`
document.body.append(charttutor_embed_elemment_andu)
const container = document.getElementById("idallchattutor");
const container = document.getElementById("move-andu");
const movecontainer = document.getElementById("moveidallchattutor");
const movecontainer2 = document.getElementById("msgInputDiv");

function onMouseDrag(e) {
if(!should_move) {
return
}
e.preventDefault()
const movementX = e.movementX
const movementY = e.movementY
global_movex += movementX;
global_movey += movementY;
movecontainer.style.transition = "none"
movecontainer.style.animation = "none"

movecontainer.style.scale = "unset"
movecontainer.style.transform = `translate(${global_movex}px, ${global_movey}px)`;
// container.style.backgroundColor = `red`;
// console.log(container.style.transform)
// console.log(container.style.backgroundColor)
// console.log("hehehe", movementX, movementY)
}

container.addEventListener("mousedown", () => {
document.addEventListener("mousemove", onMouseDrag);
});

document.addEventListener("mouseup", () => {
document.removeEventListener("mousemove", onMouseDrag);
movecontainer.style.transition = "all 0.2s ease"
// movecontainer2.style.transition = "all 0.2s ease"
});

movecontainer2.addEventListener('mouseenter', () => {
should_move = false
})

movecontainer2.addEventListener('mouseleave', () => {
should_move = true
})

console.log(window.location)

let path = window.location.pathname
Expand Down Expand Up @@ -74,22 +114,22 @@ let chattutor_embed = `
<div>
</div>
<div class="embed-chattutor-window">
<div class="embed-chattutor-window" id="moveidallchattutor">
<section class="msger" id="moveidallchattutor">
<section class="msger">
<div class="msg-header-helper">
<header class="msger-header" id="idallchattutor">
<div class="msger-header-title">
<div style="display: flex; flex-direction: row">
<button class="close-embed"></button>
<button class="theme-button" id="themeBtn"></button>
</div>
<span style="padding-left: 5px"><b>ChatTutor</b></span>
<span id="addUrl">Add URL</span>
<button class="close-embed btn">x</button>
</div>
<div class="msger-header-options">
<span><i class="fas fa-cog"></i></span>
</div>
<!-- <div class="button-div" id="themeBtnDiv">
Expand Down Expand Up @@ -321,7 +361,7 @@ function JSONparse(exp, or = '') {
}

const darkMode = {
body_bg: 'linear-gradient(135deg, #3e3c46 0%, #17232c 100%)',
body_bg: '#3e3c46',
msger_bg: '#2d2d2d',
border: '1px solid #2d2d2d',

Expand Down Expand Up @@ -596,8 +636,8 @@ function windowIsResizing() {
btn.style.textDecoration = 'underline'
btn.style.padding = '0'
btn.style.boxShadow = 'none'
btn.style.border = 'none'
btn.style.borderRadius = '0px'
// btn.style.border = 'none'
// btn.style.borderRadius = '0px'
btn.style.margin = '0'

btn.style.height = 'unset'
Expand Down Expand Up @@ -676,7 +716,7 @@ document.addEventListener('DOMContentLoaded', setThemeOnRefresh)
document.addEventListener('DOMContentLoaded', windowIsResizing)

// Event listener for toggling the theme
// themeBtn.addEventListener('click', toggleDarkMode)
themeBtn.addEventListener('click', toggleDarkMode)

stopGenButton.addEventListener('click', stopGenerating)

Expand Down
Loading

0 comments on commit 95e976a

Please sign in to comment.