From 524afe9c6e873e127d353f68679fa7188f51c441 Mon Sep 17 00:00:00 2001 From: Haocen Xu Date: Sun, 3 Jun 2018 22:43:11 -0400 Subject: [PATCH] Responsive design for mobile devices. Signed-off-by: Haocen Xu --- static/index.html | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/static/index.html b/static/index.html index 34adb3d..5b16823 100644 --- a/static/index.html +++ b/static/index.html @@ -4,6 +4,7 @@ hastebin + @@ -33,7 +34,38 @@ $(function() { app = new haste('hastebin', { twitter: true }); handlePop({ target: window }); + responsive(); }); + + function responsive() { + // apply touch device specific style + if ("ontouchstart" in document.documentElement) { + 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'); + key.style.top = 'auto'; + key.style.bottom = '0px'; + + var box1 = document.getElementById('box1'); + box1.style.transition = 'opacity 1s'; + setTimeout(() => { + box1.style.opacity = 0; + box1.addEventListener('transitionend', function(event) { + box1.parentElement.removeChild(box1) + }, { + capture: false, + once: true + }); + + var tArea = document.querySelector('textarea'); + tArea.style.paddingBottom = '95px'; + }, 1000); + } + }