Skip to content

Instantly share code, notes, and snippets.

@eldhosejoys
Created November 5, 2019 00:55
Show Gist options
  • Save eldhosejoys/8ae97cb553132c89af3880b6bdf9e636 to your computer and use it in GitHub Desktop.
Save eldhosejoys/8ae97cb553132c89af3880b6bdf9e636 to your computer and use it in GitHub Desktop.
html of the URL Page
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#clearAll").click( function() {
$("#input").val("");
$("#output").attr("src","about:blank");
});
});
$(document).ready(function(){
$(".content-tab").height($(window).height());
$(".content-tab").width($(window).width());
$( window ).resize(function() {
$(".content-tab").height($(window).height());
$(".content-tab").width($(window).width());
});
});
// removing onclick after one click
$(".webviewlink").click(function() {
$(".webviewlink").attr('onclick', '');
});
</script>
<style>
body, html {
height:100%;
margin:0;
padding: 0;
font-family: Arial;}
[data-tab-content] {
display: none;
}
.active[data-tab-content] {
display: block;
}
/* Style the tab */
.tab {
border: none;
outline: none;
overflow: hidden;
cursor: pointer;
padding: 3px 3px;
border: 1px solid #ccc;
background-color: #f1f1f1;
}
/* Style the buttons inside the tab */
.tab li {
background-color: inherit;
float: left;
border: none;
outline: none;
cursor: pointer;
padding: 6px 12px;
font-size: 17px;
}
/* Change background color of buttons on hover */
.tab li:hover {
background-color: #ddd;
}
/* Create an active/current tablink class */
.tab li.active {
background-color: #ccc;
}
/* Style the tab content */
.tabcontent {
display: none;
padding: 6px 12px;
border: 1px solid #ccc;
border-top: none;
}
/* Style the tab content */
.content-tab body,html {
overflow:hidden;
}
.aboutinfo {
overflow:scroll;
height: 100%;
}
</style>
</head>
<body>
<div class="tab " >
<li data-tab-target="#codeview" class="active tab" style="float:left; list-style-type: none;">CodeView</li>
<form id="tester" target="output" method="post" action="show.php">
<input hidden id="input" wrap="logical" cols="90" rows="12" value="ghfgh" name="custom"/>
<li onclick="tester.submit();" data-tab-target="#webview" class="webviewlink tab" style="float:left; list-style-type: none;" type="submit">WebView</li>
<input hidden value="hashcode" name="id"/>
</form>
<form id="randomurl" method="GET" action="example.com"> <li onclick="document.getElementById('randomurl').submit(); return false;" style="color:MediumSeaGreen; list-style-type: none;" >View without Iframe.
</li>
<input hidden name="randomkey" value="rand"/>
<input hidden name="key" value="keyid"/>
</form>
<li data-tab-target="#about" class="tab" style="float:right; list-style-type: none;">About this Page</li>
</div>
<div class="tab-content" >
<center> <div id="codeview" data-tab-content class="active content-tab" >
<textarea readonly style="border: none;margin-left:0px;margin-right:0px;margin-top:5px;margin-bottom:5px;height:93.5%; width:99.5%">
sometext or data
</textarea>
</div></center>
<div id="webview" data-tab-content class="content-tab" >
<iframe id="output" src="about:blank" name="output" frameborder="0" width="100%" height="93.9%"> </iframe>
</div>
<div id="about" class="aboutinfo" data-tab-content style="overflow:visible;">
<!DOCTYPE html>
<html>
<body>
<center>
<h1>About this Page</h1>
<p>User-made code has been loaded to this page</p>
<p>The code will not run until you click the "WebView" button in the Tab.</p>
<p>By clicking the "WebView" button, and View without Iframe, you agree to our <a href="javascript:void(0);" class="w3-hover-text-green" onclick="document.getElementById('loadDisclaimer').style.display='block';">terms and conditions</a>.</p>
<br><p>Use <a href="example.com" target="_blank"><strong>example.com</strong></a> for Rendering without iframe.</p><p>Visit <a href="https://example.com/?ref=URL" target="_blank"><strong>example.com</strong></a> for hosting similar.</p>
<div id="loadDisclaimer" style="display:none;">
<br>
<p>All shared files are made public by default.</p>
<p>All code in this page are supplied by users, and belongs to the code holder.</p>
<p>Any code can be removed without warning (if it is deemed offensive, damaging or for any other reason).</p>
<p>example.com are not responsible or liable for any loss or damage of any kind during the usage of provided code.</p>
</div>
</center>
</body>
</html>
</div>
</div>
<script>const tabs = document.querySelectorAll('[data-tab-target]')
const tabContents = document.querySelectorAll('[data-tab-content]')
tabs.forEach(tab => {
tab.addEventListener('click', () => {
const target = document.querySelector(tab.dataset.tabTarget)
tabContents.forEach(tabContent => {
tabContent.classList.remove('active')
})
tabs.forEach(tab => {
tab.classList.remove('active')
})
tab.classList.add('active')
target.classList.add('active')
})
})</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment