A Pen by Tigran Soghomonyan on CodePen.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="modeSwitcher"> | |
| <input type="checkbox" id="mode" /> | |
| <label for="mode"></label> | |
| </div> | |
| <div class="container"> | |
| <a href="javascript:void(0)" data-network="facebook" class="icon"> | |
| <i class="fa fa-facebook"></i> | |
| </a> | |
| <a href="javascript:void(0)" data-network="linkedin" class="icon"> | |
| <i class="fa fa-linkedin"></i> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function decode(jwt) { | |
| const [headerB64, payloadB64] = jwt.split('.'); | |
| const headerStr = base64UrlDecode(headerB64); | |
| const payloadStr = base64UrlDecode(payloadB64); | |
| return { | |
| header: JSON.parse(headerStr), | |
| payload: JSON.parse(payloadStr) | |
| }; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function encode(h, p, s) { | |
| const header = base64UrlEncode(JSON.stringify(h)); | |
| const payload = base64UrlEncode(JSON.stringify(p)); | |
| const signature = s ? base64UrlEncode(JSON.stringify(p)) : ""; | |
| return `${header}.${payload}.${signature}`; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isIE(){ | |
| return ua.indexOf('MSIE ') > 0 || ua.indexOf('Trident/') > 0; | |
| } | |
| document.querySelector("[contenteditable]").addEventListener("paste", function (e) { | |
| e.preventDefault(); | |
| let text = ""; | |
| if (isIE()) { | |
| text = window.clipboardData.getData('text'); | |
| e.target.innerText += text; | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isIE(){ | |
| return ua.indexOf('MSIE ') > 0 || ua.indexOf('Trident/') > 0; | |
| } | |
| $("body").off("paste", "[contenteditable]").on("paste", "[contenteditable]", function(e){ | |
| e.preventDefault(); | |
| let text = ""; | |
| if (isIE()) { | |
| text = window.clipboardData.getData("text"); | |
| e.target.innerText += text; | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function isIE(){ | |
| var ua = window.navigator.userAgent; | |
| return ua.indexOf('MSIE ') > 0 || ua.indexOf('Trident/') > 0; | |
| } | |
| document.querySelector("div[contenteditable]").addEventListener("paste", function (e) { | |
| e.preventDefault(); | |
| var text = ""; | |
| if (isIE()) { | |
| text = window.clipboardData.getData('text'); | |
| document.querySelector("div[contenteditable]").innerText += text; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .textarea { | |
| min-height: 30px; | |
| border: 1px solid #d6d6d6; | |
| position: relative; | |
| } | |
| .textarea__placeholder { | |
| content: attr(data-placeholderText); | |
| color: #d6d6d6; | |
| pointer-events: none; | |
| position: absolute; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| input::-ms-clear { display: none; } | |
| /* Or */ | |
| input::-ms-clear { visibility: hidden; } | |
| /* A hackier hack might be to use the margin-right and overflow properties */ | |
| input { margin-right: -20px; overflow: hidden } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Random RGB Code Generator | |
| function randomRGB() { | |
| var r = Math.floor(Math.random() * 255), g = Math.floor(Math.random() * 255), b = Math.floor(Math.random() * 255); | |
| return "rgb(" + r + ", " + g + ", " + b + ")"; | |
| } | |
| // Random RGBA Code Generator | |
| function randomRGBA() { | |
| var r = Math.floor(Math.random() * 255), g = Math.floor(Math.random() * 255), b = Math.floor(Math.random() * 255), a = Math.random(); | |
| return "rgba(" + r + ", " + g + ", " + b + ", " + a + ")"; |
NewerOlder