Skip to content
This repository has been archived by the owner on Jan 18, 2018. It is now read-only.

Added dogescript #12

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
16 changes: 16 additions & 0 deletions compile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
var dogescript = require("dogescript");

var dsScripts = Array.from(document.querySelectorAll("script")).filter(function (x) {
return x.type === "text/dogescript";
});

dsScripts.forEach(function (script) {
var xhr = new XMLHttpRequest();
xhr.onreadystatechange = function () {
if (xhr.readyState == XMLHttpRequest.DONE) {
eval.call(window, dogescript(xhr.responseText, false, false));
}
};
xhr.open('GET', script.src, true);
xhr.send();
});
2 changes: 2 additions & 0 deletions compileDJS.js

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions index.css
Original file line number Diff line number Diff line change
Expand Up @@ -191,3 +191,16 @@ form{
}
}

/* modified from https://gist.github.com/ratbeard/9076500 */
.rainbow-text {
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-image: -webkit-gradient(linear, left top, right top,
color-stop(0.00, red),
color-stop(16%, orange),
color-stop(32%, yellow),
color-stop(48%, green),
color-stop(60%, blue),
color-stop(76%, indigo),
color-stop(1.00, violet));
}
74 changes: 74 additions & 0 deletions index.djs
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
such setStyle much elementID property value
very element is plz dogeument.getElementById with elementID
plz element.style.setProperty with property value
wow

such hideLoadingScreen
plz setStyle with "loadingElement" "display" "none"
wow

plz $ with much
wow& hideLoadingScreen()

very animations is []
animations dose push "spin"
animations dose push "zoom"
animations dose push "bg"
animations dose push "invert"
animations dose push "blur"
animations dose push "rainbow"

such displayLoadingScreen
very animationToUse is animations[Math.floor(Math.random() * animations.length)]
plz setStyle with "loadingElement" "display" "block"
plz setStyle with "loadingTrollFaceScreen" "animationName" animationToUse
wow

such getImages much query
plz displayLoadingScreen

very rnd is maybe shh Keep this comment
shh Keep this line as well
very displayType is rnd ? 'cat' : 'doge'

very postOb is {}
postOb.url is "https://api.memetrash.co.uk/" dose concat with displayType
postOb.crossDomain is true
postOb.data is {}
postOb.data.text is query
postOb.data.quantity is 3

$ dose post with postOb&
dose done with much httpData
very imageCont is document dose createElement with "div"
imageCont.id is "downloadedImageInner"

httpData["data"]["images"] dose forEach with much image
very newImage is document dose createElement with "img"
newImage.src is image;
imageCont dose appendChild with newImage
wow&

plz setStyle with "downloadedImageOuter" "display" "block"

very outerImg is document dose getElementById with "downloadedImageOuter"
very innerImg is document dose getElementById with "downloadedImageInner"

outerImg dose replaceChild with imageCont innerImg
plz hideLoadingScreen
wow&
.plz fail with much error
plz hideLoadingScreen
plz alert "YOU HAZ ERRORS"
wow&
wow

such postForm
very inputBox is document dose getElementById with "inputBox"
rly inputBox.value not ""
plz getImages with inputBox.value
but
very promptStr is "Enter a value"
plz alert with promptStr
wow
wow
6 changes: 5 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,13 @@ <h1>
<div style="display:inline">
© Mike freeman
</div>
<p>
Powered by <span style="text-align: right" class="rainbow-text">Dogescript</span>
</P>
</footer>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://memetrash.co.uk/index.js"></script>
<script type="text/dogescript" src="https://memetrash.co.uk/index.djs"></script>
<script src="https://memetrash.co.uk/compileDJS.js"></script>
</body>
</html>
15 changes: 15 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"name": "meme-generator-web",
"version": "1.0.0",
"description": "",
"main": "compile.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"prepublish": "npm run-script build",
"build": "webpack -p"
},
"private": true,
"dependencies": {
"dogescript": "2.3.0"
}
}
9 changes: 9 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
entry: './compile.js',
output: {
filename: './compileDJS.js'
},
resolve: {
extensions: ['', '.webpack.js', '.web.js', '.js', '.json']
}
}