diff options
author | ache <ache@ache.one> | 2019-03-07 05:10:28 +0100 |
---|---|---|
committer | ache <ache@ache.one> | 2019-03-07 05:10:28 +0100 |
commit | 21c7cbf4081e6bb9f729877af893e3fdbeab782a (patch) | |
tree | 071c4c10f0bc0e7ead768ed9f25c4b47fd8d98c0 |
Init commit
-rw-r--r-- | index.html | 215 | ||||
-rw-r--r-- | unfriend.png | bin | 0 -> 110797 bytes |
2 files changed, 215 insertions, 0 deletions
diff --git a/index.html b/index.html new file mode 100644 index 0000000..9ae8b65 --- /dev/null +++ b/index.html @@ -0,0 +1,215 @@ +<!DOCTYPE html> +<html> + <head> + <meta charset="utf-8"> + <title>Coupon de Fartage</title> + </head> +<style> +input[type=checkbox] { + position:absolute; + opacity:0; + left:-9999px; +} +input[type=input] { + background: transparent; + outline: none; + border: 0px solid; +} +input[type=checkbox] + label:before{ + content: ''; + margin-right: 10px; + display: inline-block; + vertical-align: text-top; + width: 20px; + height: 20px; + background: transparent; + font-size:1.3em; +} +input:checked + label:before { + content: ' ✓'; + text-indent: 2px; +} +#blocked + label{ + position:absolute;left:355px;top:194px; +} +#banned + label { + position:absolute;left:356px;top:166px; +} +#unfriended + label { + position:absolute;left:484px;top:192px; +} +#unfollowed + label { + position:absolute;left:484px;top:163px; +} +#big_mouth + label { + position:absolute;left:350px;top:293px; +} +#discrim_joke + label { + position:absolute;left:351px;top:368px; +} +#jerk + label { + position:absolute;left:350px;top:444px; +} +#censure + label { + position:absolute;left:537px;top:289px; +} +#upset + label { + position:absolute;left:538px;top:366px; +} +#spam + label { + position:absolute;left:540px;top:448px; +} +#other + label { + position:absolute;left:352px;top:523px; +} +#dicks_name { + position:absolute;left:438px;top:104px; + font-size: 1.2em; + color: yellow; + font-weight: bold; +} +#other_value{ + position:absolute;left:444px;top:521px; + color: black; + font-weight: bold; +} +.coupon { + width: 700px; + height: 569px; + position: absolute; + left: 50%; + top: 50%; + margin-left: -350px; + margin-top: -269px; +} +</style> + <body> + <div class="coupon"> + <img src="unfriend.png"/> + <input type="checkbox" id="blocked"> + <label for="blocked" tabindex="0"></label> + + <input type="checkbox" id="banned"> + <label for="banned" tabindex="0"></label> + + <input type="checkbox" id="unfriended"> + <label for="unfriended" tabindex="0"></label> + + <input type="checkbox" id="unfollowed"> + <label for="unfollowed" tabindex="0"></label> + + <input type="checkbox" id="big_mouth"> + <label for="big_mouth" tabindex="0"></label> + + <input type="checkbox" id="discrim_joke"> + <label for="discrim_joke" tabindex="0"></label> + + <input type="checkbox" id="jerk"> + <label for="jerk" tabindex="0"></label> + + <input type="checkbox" id="censure"> + <label for="censure" tabindex="0"></label> + + <input type="checkbox" id="upset"> + <label for="upset" tabindex="0"></label> + + <input type="checkbox" id="spam"> + <label for="spam" tabindex="0"></label> + + <input type="checkbox" id="other"> + <label for="other" tabindex="0"></label> + + <input type="input" id="dicks_name" placeholder="@dick's name"></input> + <input type="input" id="other_value" placeholder="Reason"></input> + </div> + </body> +<script> + const urlParams = new URLSearchParams(window.location.search); + let checked = Number(urlParams.get('checked')); + const dname = urlParams.get('dname'); + const why = urlParams.get('o'); + + if( checked ) { + Array.from(document.getElementsByTagName("input")).reverse().forEach( i => { + if( checked & 1 == 1) { + i.checked = true; + } else { + i.checked = false; + } + i.disabled = true; + checked = checked>>1; + }); + Array.from(document.getElementsByTagName("label")).reverse().forEach( l => { + l.tabIndex = "-1"; + }); + document.getElementById('dicks_name').placeholder = ''; + document.getElementById('other_value').placeholder = ''; + } else { + const generateButton = document.createElement('button'); + generateButton.type = 'button'; + generateButton.appendChild(document.createTextNode('Generate')); + generateButton.addEventListener('click', (e) => { + const l = window.location; + let checked = Number(urlParams.get('checked')); + const dnameInput = document.getElementById('dicks_name'); + const otherInput = document.getElementById('other_value'); + + Array.from(document.getElementsByTagName("input")).forEach( i => { + checked = checked<<1; + if( i.checked ) { + checked+=1 + } + }); + + let uri = l.protocol + '//' + (l.hostname ? l.hostname:'') + (l.pathname ? l.pathname : ''); + + if( l.port ) { + uri += ':' + l.port; + } + uri += '?'; + if( checked ) { + uri += 'checked=' + checked + } + if( dnameInput.value ) { + if( uri.slice(-1) != '?') { + uri += '&'; + } + uri += 'dname=' + btoa(dnameInput.value); + } + if( otherInput.value ) { + if( uri.slice(-1) != '?') { + uri+='&'; + } + uri += 'o=' + btoa(otherInput.value); + } + + window.location = uri; + //console.log(uri); + }, false); + document.getElementsByClassName('coupon')[0].appendChild(generateButton); + } + if( dname ) { + document.getElementById('dicks_name').value = atob(dname); + } + + if( why ) { + console.log(atob(why)); + document.getElementById('other_value').value = atob(why); + } + + + function other_show() { + const otherInput = document.getElementById("other_value"); + const otherCheckBox = document.getElementById("other"); + + if( other.checked ) { + otherInput.style.display = "block"; + } else { + otherInput.style.display = "none"; + } + } + + window.addEventListener('change', other_show, false); + other_show(); +</script> +</html> diff --git a/unfriend.png b/unfriend.png Binary files differnew file mode 100644 index 0000000..33f0bb2 --- /dev/null +++ b/unfriend.png |