diff --git a/css/options.css b/css/options.css index bbf3f42..9fa666f 100644 --- a/css/options.css +++ b/css/options.css @@ -12,6 +12,10 @@ select { margin-bottom: 10px; } +textarea { + margin-bottom: 10px; +} + pre { left: -10px; top: 10px; diff --git a/js/background.js b/js/background.js index 6192283..3f76fac 100644 --- a/js/background.js +++ b/js/background.js @@ -77,7 +77,8 @@ theme: 'sunburst', font: 'Inconsolata', fontSize: 'medium', - lineNumbers: true + lineNumbers: true, + extBlacklist: '' }; const OPTIONS = Object.keys(OPTIONS_DEFAULTS); @@ -121,6 +122,17 @@ return filename.split('.').pop(); } + function isExtensionBlacklisted(extension) { + var blacklist = localStorage.getItem('extBlacklist').split(/[\s,]+/); + var index, length = blacklist.length; + for (index = 0; index < length; index++) { + if (blacklist[index].toLowerCase() === extension) { + return true; + } + } + return false; + } + function getFragmentFromUrl(url) { var fragment = /#ft=(\w+)/.exec(url); return fragment && fragment[1]; @@ -130,6 +142,9 @@ if (BROWSER_CONTENT.indexOf(contentType) != -1) { return null; } + if (isExtensionBlacklisted(extension)) { + return null; + } return !!LANG_EXT_MAP[fragment] ? fragment : EXT_LANG_MAP[contentType] || EXT_LANG_MAP[extension] || EXT_LANG_MAP[filename]; diff --git a/js/options.js b/js/options.js index d5272ec..060afbd 100644 --- a/js/options.js +++ b/js/options.js @@ -43,6 +43,12 @@ codeEl.innerHTML = codeEl.textContent; hljs.highlightBlock(codeEl); } + }, + extBlacklist: { + selector: '#ext-blacklist', + value: 'value', + decode: id, + render: function(value) {} } }; diff --git a/options.html b/options.html index d1b00fc..f70c78b 100644 --- a/options.html +++ b/options.html @@ -91,6 +91,8 @@

Select your font size

+

Blacklist Extensions

+

Line numbers:

 package main