New icons. Fancybox bindings separated. Post links binding added.

This commit is contained in:
Alexey Skobkin 2014-03-14 16:16:06 +04:00
parent 9f99a73e27
commit 47d8a479a0
29 changed files with 112 additions and 72 deletions

View file

Before

Width:  |  Height:  |  Size: 43 B

After

Width:  |  Height:  |  Size: 43 B

View file

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

Before

Width:  |  Height:  |  Size: 1,003 B

After

Width:  |  Height:  |  Size: 1,003 B

View file

Before

Width:  |  Height:  |  Size: 1.3 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

Before

Width:  |  Height:  |  Size: 6.4 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 411 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 414 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 662 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 744 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -0,0 +1,53 @@
// Saves options to localStorage.
function save_options() {
// CTRL+Enter
var checkbox_ctrl_enter = document.getElementById('option-ctrl-enter');
// Fancybox
// Images
var checkbox_fancybox_images = document.getElementById('option-fancybox-images');
// Videos
var checkbox_fancybox_videos = document.getElementById('option-fancybox-videos');
// Posts
var checkbox_fancybox_posts = document.getElementById('option-fancybox-posts');
// 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,
}, function() {
// Update status to let user know options were saved.
var status = document.getElementById('status');
status.innerHTML = 'Options Saved.';
setTimeout(function() {
window.close();
}, 1500);
});
}
// 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) {
// CTRL+Enter
if (options.option_ctrl_enter == true) {
document.getElementById('option-ctrl-enter').checked = true;
}
// Fancybox
// Images
if (options.option_fancybox_images == true) {
document.getElementById('option-fancybox-images').checked = true;
}
// Videos
if (options.option_fancybox_videos == true) {
document.getElementById('option-fancybox-videos').checked = true;
}
// Posts
if (options.option_fancybox_posts == true) {
document.getElementById('option-fancybox-posts').checked = true;
}
});
}
document.addEventListener('DOMContentLoaded', restore_options);
document.querySelector('#save').addEventListener('click', save_options);

View file

@ -1,9 +1,14 @@
$(document).ready(function() {
// Loading options
chrome.storage.sync.get(['option_ctrl_enter', 'option_fancybox'], function(options) {
// Fix the classes and init fancybox
if (options.option_fancybox == true) {
$('.postimg').addClass('fancybox-media').fancybox({
chrome.storage.sync.get(['option_fancybox_images', 'option_fancybox_videos', 'option_fancybox_posts', 'option_ctrl_enter'], function(options) {
// Fancybox
// Images
if (options.option_fancybox_images == true) {
$('.postimg:not(.video)').fancybox();
}
// Videos
if (options.option_fancybox_videos == true) {
$('.postimg.video').addClass('fancybox-media').fancybox({
helpers: {
media: {
youtube: {
@ -15,6 +20,12 @@ $(document).ready(function() {
}
});
}
// Posts
if (options.option_fancybox_posts == true) {
$('.post-id a').attr('data-fancybox-type', 'iframe').fancybox({
maxWidth: 780
});
}
// Send by CTRL+Enter
if (options.option_ctrl_enter == true) {
@ -26,6 +37,7 @@ $(document).ready(function() {
}
});
}
});
// Showing page action

View file

@ -1,18 +1,26 @@
{
"manifest_version": 2,
"name": "Point+",
"version": "1.0",
"version": "1.1",
"author": "Alexey Skobkin",
"homepage_url": "https://bitbucket.org/skobkin/chrome_point_plus",
"description": "Some new features for point.im",
"options_page": "options.html",
"page_action": {
"default_icon": "images/icon38.png",
"default_icon": {
"19": "images/icon19.png",
"38": "images/icon38.png"
},
"default_title": "Point+",
"default_popup": "options.html"
},
"icons": {
"128": "images/icon128.png"
"16": "images/icon16.png",
"32": "images/icon32.png",
"48": "images/icon48.png",
"64": "images/icon64.png",
"128": "images/icon128.png",
"256": "images/icon256.png"
},
"content_scripts": [
{

View file

@ -0,0 +1,32 @@
<html>
<head><title>Point Plus options</title></head>
<body style="width: 400px;">
<h2>Point+ options</h2>
<h4>Fancybox pop-up</h4>
<p>
<label><input type="checkbox" id="option-fancybox-images">Use for images</label>
</p>
<p>
<label><input type="checkbox" id="option-fancybox-videos">Use for videos</label>
</p>
<p>
<label><input type="checkbox" id="option-fancybox-posts">Use for post links (including comments)</label>
</p>
<h4>Hotkeys</h4>
<p>
<label><input type="checkbox" id="option-ctrl-enter">Send post and comments by CTRL+Enter</label>
</p>
<br>
<div id="status"></div>
<button id="save">Save</button>
<p>
<a href="https://bitbucket.org/skobkin/chrome_point_plus/issues?status=new&status=open" target="_blank">Send bug report</a>
</p>
</body>
<script src="js/options.js"></script>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 KiB

View file

@ -1,39 +0,0 @@
// Saves options to localStorage.
function save_options() {
// CTRL+Enter
var checkbox_ctrl_enter = document.getElementById('option-ctrl-enter');
// Fancybox
var checkbox_fancybox = document.getElementById('option-fancybox');
// Saving parameters
chrome.storage.sync.set({
'option_ctrl_enter': checkbox_ctrl_enter.checked,
'option_fancybox': checkbox_fancybox.checked
}, function() {
// Update status to let user know options were saved.
var status = document.getElementById('status');
status.innerHTML = 'Options Saved.';
setTimeout(function() {
window.close();
}, 1500);
});
}
// Restores select box state to saved value from localStorage.
function restore_options() {
// Loading options
chrome.storage.sync.get(['option_ctrl_enter', 'option_fancybox'], function(options) {
// CTRL+Enter
if (options.option_ctrl_enter == true) {
document.getElementById('option-ctrl-enter').checked = true;
}
;
// Fancybox
if (options.option_fancybox == true) {
document.getElementById('option-fancybox').checked = true;
}
;
});
}
document.addEventListener('DOMContentLoaded', restore_options);
document.querySelector('#save').addEventListener('click', save_options);

View file

@ -1,26 +0,0 @@
<html>
<head><title>Point Plus Options</title></head>
<body style="width: 400px;">
<h2>Point+ Options</h2>
<p>
<label><input type="checkbox" id="option-ctrl-enter">Send post and comments by CTRL+Enter</label>
</p>
<p>
<label><input type="checkbox" id="option-fancybox">Use Fancybox for images and videos</label>
</p>
<br>
<div id="status"></div>
<button id="save">Save</button>
<br>
<br>
<p>
<a href="https://bitbucket.org/skobkin/chrome_point_plus/issues?status=new&status=open" target="_blank">Send bug report</a>
</p>
</body>
<script src="js/options.js"></script>
</html>