1
0
Fork 0
mirror of https://github.com/seejohnrun/haste-server.git synced 2024-11-22 20:51:21 +00:00

Fix touch device broken use cases

This commit is contained in:
Haocen Xu 2018-06-04 00:51:42 -04:00
parent 524afe9c6e
commit 4810b0a088
2 changed files with 27 additions and 38 deletions

View file

@ -1,6 +1,6 @@
body { body {
background: #002B36; background: #002B36;
padding: 20px 50px; padding: 20px 20px 20px 50px;
margin: 0px; margin: 0px;
} }
@ -17,13 +17,15 @@ textarea {
outline: none; outline: none;
resize: none; resize: none;
font-size: 13px; font-size: 13px;
padding-bottom: 95px;
overflow-x: hidden;
} }
/* the line numbers */ /* the line numbers */
#linenos { #linenos {
color: #7d7d7d; color: #7d7d7d;
z-index: -1000; /* z-index: -1000; */
position: absolute; position: absolute;
top: 20px; top: 20px;
left: 0px; left: 0px;
@ -42,8 +44,10 @@ textarea {
border: 0px; border: 0px;
outline: none; outline: none;
font-size: 13px; font-size: 13px;
padding-right: 360px; padding-bottom: 95px;
overflow: inherit; overflow-x: scroll;
overflow-y: hidden;
box-sizing: border-box;
} }
#box code { #box code {
@ -55,7 +59,7 @@ textarea {
#key { #key {
position: fixed; position: fixed;
top: 0px; bottom: 0px;
right: 0px; right: 0px;
z-index: +1000; /* watch out */ z-index: +1000; /* watch out */
} }

View file

@ -34,37 +34,22 @@
$(function() { $(function() {
app = new haste('hastebin', { twitter: true }); app = new haste('hastebin', { twitter: true });
handlePop({ target: window }); handlePop({ target: window });
responsive(); removeBanner();
}); });
function responsive() { function removeBanner() {
// apply touch device specific style var box1 = document.getElementById('box1');
if ("ontouchstart" in document.documentElement) { box1.style.transition = 'opacity 1s';
var mTextAreaStyle = document.createElement('style');
mTextAreaStyle.setAttribute('rel', 'stylesheet')
mTextAreaStyle.setAttribute('type', 'text/css');
document.head.appendChild(mTextAreaStyle);
mTextAreaStyle.sheet.insertRule('textarea{ padding-bottom: 95px; }', 0);
var key = document.getElementById('key'); setTimeout(() => {
key.style.top = 'auto'; box1.style.opacity = 0;
key.style.bottom = '0px'; box1.addEventListener('transitionend', function(event) {
box1.parentElement.removeChild(box1);
var box1 = document.getElementById('box1'); }, {
box1.style.transition = 'opacity 1s'; capture: false,
setTimeout(() => { once: true
box1.style.opacity = 0; });
box1.addEventListener('transitionend', function(event) { }, 1000);
box1.parentElement.removeChild(box1)
}, {
capture: false,
once: true
});
var tArea = document.querySelector('textarea');
tArea.style.paddingBottom = '95px';
}, 1000);
}
} }
</script> </script>
@ -74,7 +59,11 @@
<ul id="messages"></ul> <ul id="messages"></ul>
<div id="key"> <div id="key">
<div id="pointer" style="display:none;"></div> <div id="pointer" style="display:none;"></div>
<div id="box3" style="display:none;">
<div class="label"></div>
<div class="shortcut"></div>
</div>
<div id="box1"> <div id="box1">
<a href="/about.md" class="logo"></a> <a href="/about.md" class="logo"></a>
</div> </div>
@ -85,10 +74,6 @@
<button class="raw function button-picture">Just Text</button> <button class="raw function button-picture">Just Text</button>
<button class="twitter function button-picture">Twitter</button> <button class="twitter function button-picture">Twitter</button>
</div> </div>
<div id="box3" style="display:none;">
<div class="label"></div>
<div class="shortcut"></div>
</div>
</div> </div>
<div id="linenos"></div> <div id="linenos"></div>