/* This file is dedicated to the public domain; you may do as you wish with it. */ if (typeof _ == 'undefined') { var _ = function(a) { return a; }; } // Default settings var defaultSettings = { "videoexpand": true, "videohover": false, "videovolume": 1.0 }; // Non-persistent settings for when localStorage is absent/disabled var tempSettings = {}; // Scripts obtain settings by calling this function function setting(name) { if (localStorage) { if (localStorage[name] === undefined) return defaultSettings[name]; return JSON.parse(localStorage[name]); } else { if (tempSettings[name] === undefined) return defaultSettings[name]; return tempSettings[name]; } } // Settings should be changed with this function function changeSetting(name, value) { if (localStorage) { localStorage[name] = JSON.stringify(value); } else { tempSettings[name] = value; } } // Create settings menu var settingsMenu = document.createElement("div"); var prefix = "", suffix = "", style = ""; if (window.Options) { var tab = Options.add_tab("webm", "video-camera", _("WebM")); $(settingsMenu).appendTo(tab.content); } else { prefix = ''+_('WebM Settings')+''; settingsMenu.style.textAlign = "right"; settingsMenu.style.background = "inherit"; suffix = ''; style = 'display: none; text-align: left; position: absolute; right: 1em; margin-left: -999em; margin-top: -1px; padding-top: 1px; background: inherit;'; } settingsMenu.innerHTML = prefix + '