Skip to content

Commit

Permalink
Merge pull request #462 from victornpb/drag-resize
Browse files Browse the repository at this point in the history
Resize in all directions
  • Loading branch information
victornpb authored Mar 10, 2023
2 parents 39fea4d + 21607fc commit cad1419
Show file tree
Hide file tree
Showing 7 changed files with 378 additions and 232 deletions.
270 changes: 155 additions & 115 deletions deleteDiscordMessages.user.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "undiscord",
"nameFull": "Undiscord",
"version": "5.1.1",
"version": "5.2.0",
"description": "Delete all messages in a Discord channel or DM (Bulk deletion)",
"userScript": {
"namespace": "https://github.com/victornpb/deleteDiscordMessages",
Expand Down
79 changes: 79 additions & 0 deletions src/ui/drag.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
[name^="grab-"] {
position: absolute;
--size: 6px;
--corner-size: 16px;
--offset: -1px;
z-index: 9;
}
[name^="grab-"]:hover{
background: rgba(128,128,128,0.1);
}

[name="grab-t"] {
top: 0px;
left: var(--corner-size);
right: var(--corner-size);
height: var(--size);
margin-top: var(--offset);
cursor: ns-resize;
}
[name="grab-r"] {
top: var(--corner-size);
bottom: var(--corner-size);
right: 0px;
width: var(--size);
margin-right: var(--offset);
cursor: ew-resize;
}
[name="grab-b"] {
bottom: 0px;
left: var(--corner-size);
right: var(--corner-size);
height: var(--size);
margin-bottom: var(--offset);
cursor: ns-resize;
}
[name="grab-l"] {
top: var(--corner-size);
bottom: var(--corner-size);
left: 0px;
width: var(--size);
margin-left: var(--offset);
cursor: ew-resize;
}
[name="grab-tl"] {
top: 0px;
left: 0px;
width: var(--corner-size);
height: var(--corner-size);
margin-top: var(--offset);
margin-left: var(--offset);
cursor: nwse-resize;
}
[name="grab-tr"] {
top: 0px;
right: 0px;
width: var(--corner-size);
height: var(--corner-size);
margin-top: var(--offset);
margin-right: var(--offset);
cursor: nesw-resize;
}
[name="grab-br"] {
bottom: 0px;
right: 0px;
width: var(--corner-size);
height: var(--corner-size);
margin-bottom: var(--offset);
margin-right: var(--offset);
cursor: nwse-resize;
}
[name="grab-bl"] {
bottom: 0px;
left: 0px;
width: var(--corner-size);
height: var(--corner-size);
margin-bottom: var(--offset);
margin-left: var(--offset);
cursor: nesw-resize;
}
4 changes: 2 additions & 2 deletions src/ui/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
/**** Undiscord Interface ****/
#undiscord {
position: fixed;
z-index: 99;
top: 44px;
z-index: 100;
top: 58px;
right: 10px;
display: flex;
flex-direction: column;
Expand Down
5 changes: 3 additions & 2 deletions src/undiscord-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { VERSION } from 'process.env';

import themeCss from './ui/theme.css';
import mainCss from './ui/main.css';
import dragCss from './ui/drag.css';
import buttonHtml from './ui/undiscord-button.html';
import undiscordTemplate from './ui/undiscord.html';

Expand Down Expand Up @@ -43,6 +44,7 @@ function initUI() {

insertCss(themeCss);
insertCss(mainCss);
insertCss(dragCss);

// create undiscord window
const undiscordUI = replaceInterpolations(undiscordTemplate, {
Expand All @@ -54,8 +56,7 @@ function initUI() {
document.body.appendChild(ui.undiscordWindow);

// enable drag and resize on undiscord window
new Drag(ui.undiscordWindow, $('.header'), { mode: 'move' });
new Drag(ui.undiscordWindow, $('.footer'), { mode: 'resize' });
new Drag({ elm: ui.undiscordWindow, moveHandle: $('.header') });

// create undiscord Trash icon
ui.undiscordBtn = createElm(buttonHtml);
Expand Down
Loading

0 comments on commit cad1419

Please sign in to comment.