mirror of
https://bitbucket.org/skobkin/chrome_point_plus.git
synced 2024-12-29 09:36:58 +00:00
New features: fluid layout and original images loading.
This commit is contained in:
parent
47d8a479a0
commit
1f3064ae3e
|
@ -9,13 +9,19 @@ function save_options() {
|
|||
var checkbox_fancybox_videos = document.getElementById('option-fancybox-videos');
|
||||
// Posts
|
||||
var checkbox_fancybox_posts = document.getElementById('option-fancybox-posts');
|
||||
|
||||
// Fluid layout
|
||||
var checkbox_layout_fluid = document.getElementById('option-layout-fluid');
|
||||
// Load original images
|
||||
var checkbox_images_load_original = document.getElementById('option-images-load-original');
|
||||
|
||||
// Saving parameters
|
||||
chrome.storage.sync.set({
|
||||
'option_ctrl_enter': checkbox_ctrl_enter.checked,
|
||||
'option_fancybox_images': checkbox_fancybox_images.checked,
|
||||
'option_fancybox_videos': checkbox_fancybox_videos.checked,
|
||||
'option_fancybox_posts': checkbox_fancybox_posts.checked,
|
||||
'option_fluid_layout': checkbox_layout_fluid.checked,
|
||||
'option_images_load_original': checkbox_images_load_original.checked
|
||||
}, function() {
|
||||
// Update status to let user know options were saved.
|
||||
var status = document.getElementById('status');
|
||||
|
@ -29,7 +35,7 @@ function save_options() {
|
|||
// Restores select box state to saved value from localStorage.
|
||||
function restore_options() {
|
||||
// Loading options
|
||||
chrome.storage.sync.get(['option_fancybox_images', 'option_fancybox_videos', 'option_fancybox_posts', 'option_ctrl_enter'], function(options) {
|
||||
chrome.storage.sync.get(['option_fancybox_images', 'option_fancybox_videos', 'option_fancybox_posts', 'option_ctrl_enter', 'option_images_load_original', 'option_fluid_layout'], function(options) {
|
||||
// CTRL+Enter
|
||||
if (options.option_ctrl_enter == true) {
|
||||
document.getElementById('option-ctrl-enter').checked = true;
|
||||
|
@ -47,6 +53,14 @@ function restore_options() {
|
|||
if (options.option_fancybox_posts == true) {
|
||||
document.getElementById('option-fancybox-posts').checked = true;
|
||||
}
|
||||
// Fluid layout
|
||||
if (options.option_fluid_layout == true) {
|
||||
document.getElementById('option-layout-fluid').checked = true;
|
||||
}
|
||||
// Load original images
|
||||
if (options.option_images_load_original == true) {
|
||||
document.getElementById('option-images-load-original').checked = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
document.addEventListener('DOMContentLoaded', restore_options);
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
$(document).ready(function() {
|
||||
// Loading options
|
||||
chrome.storage.sync.get(['option_fancybox_images', 'option_fancybox_videos', 'option_fancybox_posts', 'option_ctrl_enter'], function(options) {
|
||||
chrome.storage.sync.get(['option_fancybox_images', 'option_fancybox_videos', 'option_fancybox_posts', 'option_ctrl_enter', 'option_fluid_layout', 'option_images_load_original'], function(options) {
|
||||
// Fancybox
|
||||
// Images
|
||||
if (options.option_fancybox_images == true) {
|
||||
// TODO: group images to the galeries
|
||||
$('.postimg:not(.video)').fancybox();
|
||||
}
|
||||
// Videos
|
||||
|
@ -26,7 +27,7 @@ $(document).ready(function() {
|
|||
maxWidth: 780
|
||||
});
|
||||
}
|
||||
|
||||
// Hotkeys
|
||||
// Send by CTRL+Enter
|
||||
if (options.option_ctrl_enter == true) {
|
||||
$('.reply-form textarea').keydown(function(e) {
|
||||
|
@ -37,7 +38,29 @@ $(document).ready(function() {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Look and feel
|
||||
// Fluid #main layout
|
||||
if (options.option_fluid_layout == true) {
|
||||
$('#main').css({
|
||||
'width': '95%',
|
||||
'max-width': '95%'
|
||||
});
|
||||
}
|
||||
// Image resizing
|
||||
if (options.option_images_load_original == true) {
|
||||
// Setting new image source
|
||||
$('.postimg:not(.video) img').each(function(){
|
||||
console.log($(this).parent('.postimg').attr('href'));
|
||||
$(this).attr('src', $(this).parent('.postimg').attr('href'));
|
||||
});
|
||||
// Resizing
|
||||
$('.postimg:not(.video), .postimg:not(.video) img').css({
|
||||
'width': 'auto',
|
||||
'height': 'auto',
|
||||
'max-width': '100%',
|
||||
'max-height': '100%'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
// Showing page action
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"manifest_version": 2,
|
||||
"name": "Point+",
|
||||
"version": "1.1",
|
||||
"version": "1.2",
|
||||
"author": "Alexey Skobkin",
|
||||
"homepage_url": "https://bitbucket.org/skobkin/chrome_point_plus",
|
||||
"description": "Some new features for point.im",
|
||||
|
|
|
@ -18,6 +18,13 @@
|
|||
<p>
|
||||
<label><input type="checkbox" id="option-ctrl-enter">Send post and comments by CTRL+Enter</label>
|
||||
</p>
|
||||
<h4>Look and feel</h4>
|
||||
<p>
|
||||
<label><input type="checkbox" id="option-layout-fluid">Fluid layout</label>
|
||||
</p>
|
||||
<p>
|
||||
<label><input type="checkbox" id="option-images-load-original">Load original images instead of thumbnails
|
||||
</p>
|
||||
<br>
|
||||
<div id="status"></div>
|
||||
<button id="save">Save</button>
|
||||
|
|
Loading…
Reference in a new issue