- Font size adjust (#13)

- Options page bugfix
This commit is contained in:
Alexey Skobkin 2014-04-21 23:40:08 +04:00
parent 09583da801
commit 27bca63a00
4 changed files with 38 additions and 7 deletions

View file

@ -16,7 +16,9 @@ var ppOptions = [
// Comments // Comments
'option_ws_comments', 'option_ws_comments_color_fadeout', 'option_ws_comments_notifications', 'option_ws_comments', 'option_ws_comments_color_fadeout', 'option_ws_comments_notifications',
// Feeds // Feeds
'option_ws_feeds', 'option_ws_feeds_subscriptions', 'option_ws_feeds_blogs' 'option_ws_feeds', 'option_ws_feeds_subscriptions', 'option_ws_feeds_blogs',
// Font size
'option_enlarge_font', 'option_enlarge_font_size'
]; ];
// Saves options to localStorage. // Saves options to localStorage.
@ -55,6 +57,10 @@ function pp_save_options() {
var option_ws_feeds_subscriptions = document.getElementById('option-ws-feeds-subscriptions'); var option_ws_feeds_subscriptions = document.getElementById('option-ws-feeds-subscriptions');
// Blogs // Blogs
var option_ws_feeds_blogs = document.getElementById('option-ws-feeds-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');
// Saving parameters // Saving parameters
chrome.storage.sync.set({ chrome.storage.sync.set({
@ -73,7 +79,9 @@ function pp_save_options() {
'option_ws_comments_notifications': option_ws_comments_notifications.checked, 'option_ws_comments_notifications': option_ws_comments_notifications.checked,
'option_ws_feeds': option_ws_feeds.checked, 'option_ws_feeds': option_ws_feeds.checked,
'option_ws_feeds_subscriptions': option_ws_feeds_subscriptions.checked, 'option_ws_feeds_subscriptions': option_ws_feeds_subscriptions.checked,
'option_ws_feeds_blogs': option_ws_feeds_blogs.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
}, function() { }, function() {
// Update status to let user know options were saved. // Update status to let user know options were saved.
var status = document.getElementById('status'); var status = document.getElementById('status');
@ -158,6 +166,14 @@ function pp_restore_options() {
if (options.option_ws_feeds_blogs == true) { if (options.option_ws_feeds_blogs == true) {
document.getElementById('option-ws-feeds-blogs').checked = true; document.getElementById('option-ws-feeds-blogs').checked = true;
} }
// Font size
if (options.option_enlarge_font == true) {
document.getElementById('option-enlarge-font').checked = true;
}
// Size ratio
if (options.option_enlarge_font_size !== undefined) {
document.getElementById('option-enlarge-font-' + options.option_enlarge_font_size).checked = true;
}
// Showing version // Showing version
document.getElementById('pp-version').innerHTML = 'Point+ ' + getVersion() + ' by <a href="http://skobkin-ru.point.im/" target="_blank">@skobkin-ru</a>'; document.getElementById('pp-version').innerHTML = 'Point+ ' + getVersion() + ' by <a href="http://skobkin-ru.point.im/" target="_blank">@skobkin-ru</a>';

View file

@ -319,6 +319,10 @@ $(document).ready(function() {
} }
; ;
}; };
}
// Font size
if ((options.option_enlarge_font == true) && (options.option_enlarge_font_size !== undefined)) {
$('body').css('font-size', (options.option_enlarge_font_size / 100) + 'em');
} }
}); });

View file

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Point+", "name": "Point+",
"version": "1.7", "version": "1.8",
"author": "Alexey Skobkin", "author": "Alexey Skobkin",
"homepage_url": "https://bitbucket.org/skobkin/chrome_point_plus", "homepage_url": "https://bitbucket.org/skobkin/chrome_point_plus",
"description": "More features for point.im", "description": "More features for point.im",
@ -52,6 +52,7 @@
"http://*.point.im/*", "http://*.point.im/*",
"https://*.point.im/*", "https://*.point.im/*",
"storage", "storage",
"notifications" "notifications",
"tabs"
] ]
} }

View file

@ -35,7 +35,7 @@
</div> </div>
<div class="option"> <div class="option">
<input type="checkbox" id="option-images-load-original"><label for="option-images-load-original">Load original images instead of thumbnails <input type="checkbox" id="option-images-load-original"><label for="option-images-load-original">Load original images instead of thumbnails</label>
</div> </div>
<div class="option"> <div class="option">
@ -61,11 +61,21 @@
</div> </div>
<div class="option"> <div class="option">
<input type="checkbox" id="option-visual-editor-post"><label for="option-visual-editor-post">Show visual editor for posts <input type="checkbox" id="option-visual-editor-post"><label for="option-visual-editor-post">Show visual editor for posts</label>
</div> </div>
<div class="option"> <div class="option">
<input type="checkbox" id="option-search-with-google"><label for="option-search-with-google">Use Google search in header <input type="checkbox" id="option-search-with-google"><label for="option-search-with-google">Use Google search in header</label>
</div>
<div class="option">
<input type="checkbox" id="option-enlarge-font"><label for="option-enlarge-font">Enlarge font size</label>
<div class="option">
<input name="pp-font-size" id="option-enlarge-font-85" type="radio" value="85" checked="checked"><label for="option-enlarge-font-85">0.85em</label>
<input name="pp-font-size" id="option-enlarge-font-100" type="radio" value="100"><label for="option-enlarge-font-100">1em</label>
<input name="pp-font-size" id="option-enlarge-font-110" type="radio" value="110"><label for="option-enlarge-font-110">1.1em</label>
</div>
</div> </div>
</div> </div>