JSFiddle - React, Tailwind, and code Playground

by Brandon

HTML

<div id="url-container">
    <div class="page-url">
        <p id="url">test</p>
    </div>
    <div>
        <label for="encoded">Encode URL</label>
        <input id="encoded" type="checkbox" />
    </div>
    <div class="url-button">
        <a href="#" id="url-close">Close</a>
    </div>
</div>


<a id="bookmarklet" href="javascript:(function(){alert('Hello');})();">URL Length Count</a>

CSS

#bookmarklet {
    position:relative;
    font-family:Helvetica;
    font-weight:bold;
    text-decoration:none;
    color:black;
    background-color:yellow;
    top:100px;
    width:80px;
    border-radius:10px;
    padding: 10px 10px 10px 10px;
    
    
}

#url-container {
  line-height: 18px !important;
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #f6f6f6), color-stop(100%, #e3e3e3));
  background-image: -webkit-linear-gradient(#f6f6f6, #e3e3e3);
  background-image: -moz-linear-gradient(#f6f6f6, #e3e3e3);
  background-image: -o-linear-gradient(#f6f6f6, #e3e3e3);
  background-image: -ms-linear-gradient(#f6f6f6, #e3e3e3);
  background-image: linear-gradient(#f6f6f6, #e3e3e3);
  padding: 7px 10px;
  border-bottom: 1px solid #C5C5C5;
  -moz-box-shadow: rgba(0, 0, 0, 0.1) 0 5px 5px;
  -webkit-box-shadow: rgba(0, 0, 0, 0.1) 0 5px 5px;
  -o-box-shadow: rgba(0, 0, 0, 0.1) 0 5px 5px;
  box-shadow: rgba(0, 0, 0, 0.1) 0 5px 5px;
}

JavaScript

(function(){
     displayURL = function(){
         var url = location.href;
         var display = document.getElementById('url');
         display.innerText = url;
     };
     
     displayURL();
})();