/** * @author https://codepen.io/bookmarklets * @file Double Cheat Sheet - Two cheat sheets in one.
Two Regex Cheat Sheets in one bookmarklet. Replace with your own! * Original Source {@link https://cdpn.io/bookmarklets/fullpage/NobJbq#} */ javascript: var chtsht1 = 'https://i.imgur.com/M37gJv9.png'; var chtsht2 = 'https://image.slidesharecdn.com/regex-cheatsheet-100421095826-phpapp01/95/regex-cheatsheet-1-728.jpg?cb=1271843931'; if(document.getElementById('mymenu')) { document.getElementById('mymenu').remove(); }else{ var block_to_insert ; var container_block ; block_to_insert = document.createElement('div'); block_to_insert.id = 'mymenu'; function hideMenu() { document.getElementById('mymenu').remove(); }; function swapIt() { var str = document.getElementById('mymenu').innerHTML; var res = str.replace(chtsht1, chtsht2); document.getElementById('mymenu').innerHTML = res; } block_to_insert.innerHTML = '

Cheat Sheet #2               ×

'; container_block = document.getElementsByTagName('body')[0]; container_block.appendChild(block_to_insert); mymenu.setAttribute('style', 'margin-left:auto; margin-right:auto; text-align:center; background-color:#000; color:red; float:left; font-family:arial,sans,verdana; font-size:24px; z-index:10000; display: inline-block;line-height:unset!important; line-height:1!important; overflow:visible; position:fixed; float:center; top: 0; padding:2px 5px;'); };