<commit_before># toogle-styles-bookmarklet


### Put inside your bookmarks

```js
javascript:var b=document.body,c=b.hasAttribute("data-css-disabled");c?b.removeAttribute("data-css-disabled"):b.setAttribute("data-css-disabled","");if(c){var d=document.querySelectorAll("[data-css-storage]");[].slice.call(d).forEach(function(a){"STYLE"===a.tagName?a.innerHTML=f(a):"LINK"===a.tagName?a.disabled=!1:a.style.cssText=f(a)})}else d=document.querySelectorAll("[style], link, style"),[].slice.call(d).forEach(function(a){"STYLE"===a.tagName?(g(a,a.innerHTML),a.innerHTML=""):"LINK"===a.tagName?(g(a,""),a.disabled=!0):(g(a,a.style.cssText),a.style.cssText="")});function g(a,e){a.setAttribute("data-css-storage",e)}function f(a){var e=a.getAttribute("data-css-storage");a.removeAttribute("data-css-storage");return e};
```

### Tweet sized bookmarklet (only disables styles)
```js
javascript:[].slice.call(document.querySelectorAll("link,style,[style]")).forEach(function(a){a.style.cssText?a.style.cssText="":a.outerHTML=""})
```

### Code

```js
    var attributeStorage = 'data-css-storage';
    var attributeDisabled = 'data-css-disabled';

    var disabled = areStylesDisabled();
    if (disabled) {
        var elements = document.querySelectorAll('[' + attributeStorage + ']');

        [].slice.call(elements).forEach(function(el) {
            if (el.tagName === 'STYLE') {
                el.innerHTML = getFromStorage(el);
            } else if (el.tagName === 'LINK') {
                el.disabled = false;
            } else {
                el.style.cssText = getFromStorage(el);
            }
        });
    } else {
        var elements = document.querySelectorAll('[style], link, style');

        [].slice.call(elements).forEach(function(el) {
            if (el.tagName === 'STYLE') {
                saveToStorage(el, el.innerHTML);
                el.innerHTML = '';
            } else if (el.tagName === 'LINK') {
                saveToStorage(el, '');<commit_msg>tweet sized bookmarklet made shorter<commit_after># toogle-styles-bookmarklet


### Put inside your bookmarks

```js
javascript:var b=document.body,c=b.hasAttribute("data-css-disabled");c?b.removeAttribute("data-css-disabled"):b.setAttribute("data-css-disabled","");if(c){var d=document.querySelectorAll("[data-css-storage]");[].slice.call(d).forEach(function(a){"STYLE"===a.tagName?a.innerHTML=f(a):"LINK"===a.tagName?a.disabled=!1:a.style.cssText=f(a)})}else d=document.querySelectorAll("[style], link, style"),[].slice.call(d).forEach(function(a){"STYLE"===a.tagName?(g(a,a.innerHTML),a.innerHTML=""):"LINK"===a.tagName?(g(a,""),a.disabled=!0):(g(a,a.style.cssText),a.style.cssText="")});function g(a,e){a.setAttribute("data-css-storage",e)}function f(a){var e=a.getAttribute("data-css-storage");a.removeAttribute("data-css-storage");return e};
```

### Tweet sized bookmarklet - 121 characters (only disables styles)
```js
javascript:[].slice.call($("link,style,[style]")).forEach(function(a){a.style.cssText?a.style.cssText="":a.outerHTML=""})
```

### Code

```js
    var attributeStorage = 'data-css-storage';
    var attributeDisabled = 'data-css-disabled';

    var disabled = areStylesDisabled();
    if (disabled) {
        var elements = document.querySelectorAll('[' + attributeStorage + ']');

        [].slice.call(elements).forEach(function(el) {
            if (el.tagName === 'STYLE') {
                el.innerHTML = getFromStorage(el);
            } else if (el.tagName === 'LINK') {
                el.disabled = false;
            } else {
                el.style.cssText = getFromStorage(el);
            }
        });
    } else {
        var elements = document.querySelectorAll('[style], link, style');

        [].slice.call(elements).forEach(function(el) {
            if (el.tagName === 'STYLE') {
                saveToStorage(el, el.innerHTML);
                el.innerHTML = '';
            } else if (el.tagName === 'LINK') {
                saveToStorage(el, '');
{'fraction_non_alphanumeric': 0.2057788944723618, 'fraction_numerical': 0.0017587939698492463, 'mean_word_length': 3.6290697674418606, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3966186', 'n_tokens_mistral': 1307, 'n_tokens_neox': 1285, 'n_words': 156}