Created
January 11, 2016 03:26
-
-
Save cecekpawon/58ea11808f0c0b8ff160 to your computer and use it in GitHub Desktop.
hljs.user.js
This file contains 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 () { | |
// ==UserScript== | |
// @name highlight.js bundle | |
// @namespace http://blog.thrsh.net | |
// @author daYOda (THRSH) | |
// @description Save & load highlight.js download bundle | |
// @version 1.0 | |
// @require http://code.jquery.com/jquery-latest.js | |
// @grant none | |
// @match https://highlightjs.org/download* | |
// @run-at document-start | |
// ==/UserScript== | |
if ($) { | |
$(document).ready(function(){ | |
var key = "hljsbundle", hljsbundle = JSON.parse(localStorage.getItem(key)) || {}; | |
$("#download-form input[type='checkbox']") | |
.each(function(){ | |
var propname = $(this).prop("name"); | |
if (!hljsbundle.hasOwnProperty(propname)) { | |
hljsbundle[propname] = $(this).prop("checked") ? 1 : 0; | |
} | |
$(this) | |
.prop("checked", (hljsbundle[propname] === 1)) | |
.click(function(){ | |
hljsbundle[propname] = $(this).prop("checked") ? 1 : 0; | |
localStorage.setItem(key, JSON.stringify(hljsbundle)); | |
}); | |
}); | |
}); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment