forked from 1j01/98
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
subrepo: subdir: "programs/jspaint" merged: "f7fea8b1" upstream: origin: "https://github.com/1j01/jspaint.git" branch: "master" commit: "f7fea8b1" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo" commit: "2f68596"
- Loading branch information
Showing
2,101 changed files
with
40,010 additions
and
2,552 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,38 +1,44 @@ | ||
# Contributing | ||
|
||
#### Pull Requests | ||
## Pull Requests | ||
|
||
Let me know before you work on something by opening an issue or commenting on an existing one. | ||
I don't want your effort to be wasted! | ||
|
||
#### Issues | ||
|
||
Open issues! Search for issues first, but open issues for features, issues for problems... | ||
Someone may be already working on it, or I may have specific plans or requirements. | ||
I don't want your effort to be wasted! | ||
|
||
Feel free to open issues in a "meta" context, like "hey, maybe you should tag issues with 'good first issue'" etc. | ||
## Issues | ||
|
||
https://github.com/1j01/jspaint/issues | ||
[Bugs and feature requests are tracked on GitHub.](https://github.com/1j01/jspaint/issues) | ||
|
||
You can also just [email me](mailto:[email protected]) if you prefer (and I'll probably create an issue). | ||
Before opening an issue for a bug or feature request, search to see if it's already been reported. | ||
|
||
#### Windows 98 | ||
You can also [email me](mailto:[email protected]) if you prefer. | ||
|
||
JS Paint's GUI is primarily based on Paint from Windows 98. | ||
There's a nice [online emulator here](https://copy.sh/v86/?profile=windows98) | ||
that you can play around with and/or use as a reference. | ||
## Windows 98 | ||
|
||
You can open issues relating to that UI, but also for general functionality that isn't necessarily in mspaint, | ||
for instance jspaint already has affordances like unlimited undos, extra menu items, and shortcut-like features. | ||
Note: JS Paint's GUI is primarily based on Paint from Windows 98. | ||
There's a nice [online emulator](https://copy.sh/v86/?profile=windows98) | ||
that you can play around with and use as a reference. | ||
|
||
## Dev Setup | ||
|
||
* Install Node.js if you don't have it (and maybe update it) | ||
* Clone the repo | ||
* Install dependencies with `npm i` | ||
* Run `npm run dev` to start up a live-reloading web server | ||
See [**Development Setup**](./README.md#Development-Setup) on the readme. | ||
|
||
### Project Structure | ||
|
||
It's messy. A lot of stuff is in a file simply called "functions.js", to give you an idea of it. | ||
|
||
I can go into more detail [if you want..](https://github.com/1j01/jspaint/issues) | ||
- `index.html` and `app.js` are the main entry points for the app. | ||
- `functions.js` has functions that shouldn't own any global state, altho they very much modify global state, and there may be a few stateful global variables defined in there. | ||
- The project uses [jQuery](https://jquery.com/), and a convention of prefixing variables that hold jQuery objects with `$` | ||
- There are also some weird pseudo-classes like `$ColorBox` which extend and return jQuery objects. I don't recommend this pattern for new code. | ||
- Menu code and some windowing code is in `lib/os-gui/` and should be kept in sync with the [os-gui](https://github.com/1j01/os-gui) project. | ||
- Some other windowing code is in $ToolWindow.js, for windows that don't have maximize/minimize buttons; eventually this should be provided by os-gui. | ||
- `image-manipulation.js` should contain just rendering related code, and ideally no dialogs except maybe some error messages. | ||
- Some image manipulation code is also in `tools.js` and `functions.js` | ||
- CSS is in `styles/` | ||
- Layout-important CSS is kept separate from theme CSS | ||
- Localization data is in `localization/` | ||
- As of writing there's no good way to contribute translations, but [get in touch!](https://github.com/1j01/jspaint/issues/80) | ||
|
||
Any good IDE or code editor has a project-wide search (often with <kbd>Ctrl+Shift+F</kbd>). I use this all the time. | ||
I also use the "Intellisense" feature of [VS Code](https://code.visualstudio.com/) to jump to function definitions (an extra convenience over searching for function names). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
// ==UserScript== | ||
// @name Cypress Image Snapshot Viewer | ||
// @namespace https://github.com/1j01/ | ||
// @version 0.1 | ||
// @description Show diffs of screenshots within the Cypress Dashboard. Works with images from cypress-image-snapshot. To use, press D in the gallery, and then move the mouse over and out of the image. | ||
// @author Isaiah Odhner | ||
// @match https://dashboard.cypress.io/* | ||
// @grant none | ||
// @noframes | ||
// ==/UserScript== | ||
|
||
(function() { | ||
'use strict'; | ||
|
||
let cleanUp = null; | ||
|
||
function showDiffView(originalImg) { | ||
if (cleanUp) { cleanUp(); } | ||
|
||
var screenshotWidth = originalImg.naturalWidth / 3; | ||
var screenshotHeight = originalImg.naturalHeight; | ||
originalImg.style.opacity = "0"; | ||
var img = document.createElement("img"); | ||
img.src = originalImg.src; | ||
img.style.position = "absolute"; | ||
img.style.left = "0"; | ||
img.style.pointerEvents = "all"; | ||
img.draggable = false; | ||
img.addEventListener("mouseenter", ()=> { | ||
img.style.left = `${-2 * screenshotWidth}px`; | ||
}); | ||
img.addEventListener("mouseleave", ()=> { | ||
img.style.left = "0"; | ||
}); | ||
var container = document.createElement("div"); | ||
container.style.width = `${screenshotWidth}px`; | ||
container.style.height = `${screenshotHeight}px`; | ||
container.style.position = "relative"; | ||
container.style.overflow = "hidden"; | ||
container.style.margin = "auto"; | ||
var outerContainer = document.createElement("div"); | ||
outerContainer.style.position = "fixed"; | ||
outerContainer.style.display = "flex"; | ||
outerContainer.style.left = "0"; | ||
outerContainer.style.right = "0"; | ||
outerContainer.style.top = "0"; | ||
outerContainer.style.bottom = "0"; | ||
outerContainer.style.zIndex = "100000"; | ||
outerContainer.style.pointerEvents = "none"; | ||
|
||
outerContainer.appendChild(container); | ||
container.appendChild(img); | ||
document.body.appendChild(outerContainer); | ||
|
||
cleanUp = ()=> { | ||
originalImg.style.opacity = ""; | ||
container.style.transformOrigin = "center center"; | ||
container.style.transition = "opacity 0.2s ease, transform 0.2s ease"; | ||
container.style.opacity = 0; | ||
container.style.transform = "scale(0.9)"; | ||
setTimeout(()=> { | ||
outerContainer.remove(); | ||
}, 500); | ||
cleanUp = null; | ||
}; | ||
} | ||
|
||
addEventListener("keydown", e=> { | ||
if (e.key === "d") { | ||
if (cleanUp) { | ||
cleanUp(); | ||
} else { | ||
var originalImg = document.elementFromPoint(innerWidth/2, innerHeight/2); | ||
if (!originalImg || !originalImg.matches("img")) { | ||
console.warn("Didn't find an image in the middle of the page. Found", originalImg); | ||
return; | ||
} | ||
showDiffView(originalImg); | ||
} | ||
} else if (e.key === "Escape") { | ||
if (cleanUp) { cleanUp(); } | ||
} | ||
}); | ||
|
||
// mousedown is TAKEN - with stopPropagation, presumably | ||
// (useCapture doesn't help) | ||
addEventListener("pointerdown", (e)=> { | ||
if (cleanUp) { cleanUp(); } | ||
}); | ||
|
||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "Using fixtures to represent data", | ||
"email": "[email protected]", | ||
"body": "Fixtures are a great way to mock data for responses to routes" | ||
} |
Oops, something went wrong.