Skip to content

Instantly share code, notes, and snippets.

@lwcorp
lwcorp / darkthemeswitcher-inline.js
Last active June 16, 2026 15:18 — forked from frontdevops/darkthemeswitcher-inline.js
Bookmarklet - Simple Dark Theme for web pages, but without: 1) Affecting iframes (like embedded YouTube) 2) Images that use background-image= instead of <img 3) Outdated style type
javascript:(d=>{var css=`:root{background-color:#fefefe;filter:invert(100%)}iframe,[style*="background-image:"]:not([style$=".svg)"]),img:not([src*=".svg"]),video{filter:invert(100%)}`,style,id="dark-theme-snippet",ee=d.getElementById(id);if(null!=ee)ee.parentNode.removeChild(ee);else{style=d.createElement('style');style.id=id;if(style.styleSheet)style.styleSheet.cssText=css;else style.appendChild(d.createTextNode(css));(d.head||d.querySelector('head')).appendChild(style);}})(document)
@lwcorp
lwcorp / pastepad_he-inline.js
Last active October 16, 2020 09:56
Bookmarklet - Add Hebrew/RTL support FiveFilters.org's PastePad - when pushing to Kindle/creating files, make the text become right-to-left if it contains Hebrew
javascript:function add_heb_support_prepare(a){var b,c,d,e,f=document.querySelectorAll("input[type=\"submit\"]");for(e=0;e<f.length;e++)f[e].setAttribute("onclick","add_heb_support()");b=`
function add_heb_support() {
var prefix='<html lang="he" />', source_value = CKEDITOR.instances.body.getData(), source = '#cke_contents_body>textarea', source_btn = '#cke_34';
if (document.querySelectorAll(source).length==0)
document.querySelector(source_btn).click();
if(source_value.indexOf(prefix) == -1 && contains_heb(source_value))
CKEDITOR.instances.body.setData(prefix + source_value);
}
function contains_heb(str) {
return (/[\u0590-\u05FF]/).test(str);