mirror of
https://bitbucket.org/skobkin/chrome_point_plus.git
synced 2024-12-29 09:36:58 +00:00
Continue to refactor options.
This commit is contained in:
parent
6951f07bdd
commit
dbd857b9a7
|
@ -41,78 +41,34 @@ var ppOptions = [
|
|||
|
||||
// Saves options to localStorage.
|
||||
function pp_save_options() {
|
||||
// CTRL+Enter
|
||||
var option_ctrl_enter = document.getElementById('option-ctrl-enter');
|
||||
// Fancybox
|
||||
//
|
||||
var option_fancybox = document.getElementById('option-fancybox');
|
||||
// Images
|
||||
var option_fancybox_images = document.getElementById('option-fancybox-images');
|
||||
// Videos
|
||||
var option_fancybox_videos = document.getElementById('option-fancybox-videos');
|
||||
// Posts
|
||||
var option_fancybox_posts = document.getElementById('option-fancybox-posts');
|
||||
// Fluid layout
|
||||
var option_fluid_layout = document.getElementById('option-layout-fluid');
|
||||
// Load original images
|
||||
var option_images_load_original = document.getElementById('option-images-load-original');
|
||||
// Embedding
|
||||
var option_embedding = document.getElementById('option-embedding');
|
||||
// Visual editor for posts
|
||||
var option_visual_editor_post = document.getElementById('option-visual-editor-post');
|
||||
// Google search
|
||||
var checkbox_search_with_google = document.getElementById('option-search-with-google');
|
||||
// WebSocket
|
||||
//
|
||||
var option_ws = document.getElementById('option-ws');
|
||||
// Comments
|
||||
var option_ws_comments = document.getElementById('option-ws-comments');
|
||||
// Fade out highlight comments
|
||||
var option_ws_comments_color_fadeout = document.getElementById('option-ws-comments-color-fadeout');
|
||||
// Comments desktop notifications
|
||||
var option_ws_comments_notifications = document.getElementById('option-ws-comments-notifications');
|
||||
// Feeds
|
||||
var option_ws_feeds = document.getElementById('option-ws-feeds');
|
||||
// Subscriptions
|
||||
var option_ws_feeds_subscriptions = document.getElementById('option-ws-feeds-subscriptions');
|
||||
// Blogs
|
||||
var option_ws_feeds_blogs = document.getElementById('option-ws-feeds-blogs');
|
||||
// Font size
|
||||
var option_enlarge_font = document.getElementById('option-enlarge-font');
|
||||
// Size ratio
|
||||
var option_enlarge_font_size = document.querySelector('input[name="pp-font-size"]:checked');
|
||||
// @ before username
|
||||
var option_at_before_username = document.getElementById('option-at-before-username');
|
||||
ppOptions = {};
|
||||
ppOptions.option_ctrl_enter = document.getElementById('option-ctrl-enter').checked;
|
||||
ppOptions.option_fancybox = document.getElementById('option-fancybox').checked;
|
||||
ppOptions.option_fancybox_images = document.getElementById('option-fancybox-images').checked;
|
||||
ppOptions.option_fancybox_videos = document.getElementById('option-fancybox-videos').checked;
|
||||
ppOptions.option_fancybox_posts = document.getElementById('option-fancybox-posts').checked;
|
||||
ppOptions.option_fluid_layout = document.getElementById('option-layout-fluid').checked;
|
||||
ppOptions.option_images_load_original = document.getElementById('option-images-load-original').checked;
|
||||
ppOptions.option_embedding = document.getElementById('option-embedding').checked;
|
||||
ppOptions.option_images_load_booru = document.getElementById('option-images-load-booru').checked;
|
||||
ppOptions.option_videos_parse_webm = document.getElementById('option-videos-parse-webm').checked;
|
||||
ppOptions.option_visual_editor_post = document.getElementById('option-visual-editor-post').checked;
|
||||
ppOptions.checkbox_search_with_google = document.getElementById('option-search-with-google').checked;
|
||||
ppOptions.option_ws = document.getElementById('option-ws').checked;
|
||||
ppOptions.option_ws_comments = document.getElementById('option-ws-comments').checked;
|
||||
ppOptions.option_ws_comments_color_fadeout = document.getElementById('option-ws-comments-color-fadeout').checked;
|
||||
ppOptions.option_ws_comments_notifications = document.getElementById('option-ws-comments-notifications').checked;
|
||||
ppOptions.option_ws_feeds = document.getElementById('option-ws-feeds').checked;
|
||||
ppOptions.option_ws_feeds_subscriptions = document.getElementById('option-ws-feeds-subscriptions').checked;
|
||||
ppOptions.option_ws_feeds_blogs = document.getElementById('option-ws-feeds-blogs').checked;
|
||||
ppOptions.option_enlarge_font = document.getElementById('option-enlarge-font').checked;
|
||||
ppOptions.option_enlarge_font_size = document.querySelector('input[name="pp-font-size"]:checked').value;
|
||||
ppOptions.option_at_before_username = document.getElementById('option-at-before-username').checked;
|
||||
ppOptions.option_other_hightlight_post_comments = document.getElementById('option-other-hightlight-post-comments').checked;
|
||||
ppOptions.option_other_show_recommendation_count = document.getElementById('option-other-show-recommendation-count').checked;
|
||||
|
||||
// Saving parameters
|
||||
chrome.storage.sync.set({
|
||||
'option_ctrl_enter': option_ctrl_enter.checked,
|
||||
'option_fancybox': option_fancybox.checked,
|
||||
'option_fancybox_images': option_fancybox_images.checked,
|
||||
'option_fancybox_videos': option_fancybox_videos.checked,
|
||||
'option_fancybox_posts': option_fancybox_posts.checked,
|
||||
'option_fluid_layout': option_fluid_layout.checked,
|
||||
'option_images_load_original': option_images_load_original.checked,
|
||||
'option_embedding': option_embedding.checked,
|
||||
'option_visual_editor_post': option_visual_editor_post.checked,
|
||||
'option_search_with_google': checkbox_search_with_google.checked,
|
||||
'option_ws': option_ws.checked,
|
||||
'option_ws_comments': option_ws_comments.checked,
|
||||
'option_ws_comments_color_fadeout': option_ws_comments_color_fadeout.checked,
|
||||
'option_ws_comments_notifications': option_ws_comments_notifications.checked,
|
||||
'option_ws_feeds': option_ws_feeds.checked,
|
||||
'option_ws_feeds_subscriptions': option_ws_feeds_subscriptions.checked,
|
||||
'option_ws_feeds_blogs': option_ws_feeds_blogs.checked,
|
||||
'option_enlarge_font': option_enlarge_font.checked,
|
||||
'option_enlarge_font_size': option_enlarge_font_size.value,
|
||||
'option_at_before_username': option_at_before_username.checked,
|
||||
|
||||
'option_images_load_booru' :document.getElementById('option-images-load-booru').checked,
|
||||
'option_videos_parse_webm' :document.getElementById('option-videos-parse-webm').checked,
|
||||
'option_other_hightlight_post_comments' :document.getElementById('option-other-hightlight-post-comments').checked,
|
||||
'option_other_show_recommendation_count':document.getElementById('option-other-show-recommendation-count').checked
|
||||
|
||||
}, function() {
|
||||
chrome.storage.sync.set(ppOptions, function() {
|
||||
// Update status to let user know options were saved.
|
||||
var status = document.getElementById('status');
|
||||
status.innerHTML = 'Options Saved.';
|
||||
|
@ -159,6 +115,14 @@ function pp_restore_options() {
|
|||
if (options.option_embedding == true) {
|
||||
document.getElementById('option-embedding').checked = true;
|
||||
}
|
||||
// Load images from Gelbooru, Danbooru, etc
|
||||
if (options.option_images_load_booru == true) {
|
||||
document.getElementById('option-images-load-booru').checked = true;
|
||||
}
|
||||
// Wrap WEBM videos into the <video> tag
|
||||
if (options.option_videos_parse_webm == true) {
|
||||
document.getElementById('option-videos-parse-webm').checked = true;
|
||||
}
|
||||
// Visual editor for posts
|
||||
if (options.option_visual_editor_post == true) {
|
||||
document.getElementById('option-visual-editor-post').checked = true;
|
||||
|
@ -208,16 +172,11 @@ function pp_restore_options() {
|
|||
if (options.option_at_before_username == true) {
|
||||
document.getElementById('option-at-before-username').checked = true;
|
||||
}
|
||||
|
||||
if (options.option_images_load_booru == true) {
|
||||
document.getElementById('option-images-load-booru').checked = true;
|
||||
}
|
||||
if (options.option_videos_parse_webm == true) {
|
||||
document.getElementById('option-videos-parse-webm').checked = true;
|
||||
}
|
||||
// Highlight posts with new comments
|
||||
if (options.option_other_hightlight_post_comments == true) {
|
||||
document.getElementById('option-other-hightlight-post-comments').checked = true;
|
||||
}
|
||||
// Show recommendations and unique comments count
|
||||
if (options.option_other_show_recommendation_count == true) {
|
||||
document.getElementById('option-other-show-recommendation-count').checked = true;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue