Merged skobkin/chrome_point_plus into master

This commit is contained in:
Никита Ветров 2014-11-15 12:20:33 +03:00
commit 5519280c3d
5 changed files with 119 additions and 201 deletions

30
README.md Normal file
View file

@ -0,0 +1,30 @@
# README #
Коротенькое пояснение what the fuck is going on.
### Что это за репозиторий? ###
В данном репозитории располагаются исходные коды расширения Point+, которое предназначено для расширения функциональности сайта [Point.im](https://point.im/).
### Как заставить его работать? ###
Есть несколько вариантов. Выбирайте на свой вкус:
* Установить расширение из [репозитория Opera addons](https://addons.opera.com/en/extensions/details/point/?display=en)
* Установить расширение из [репозитория Google Chrome Extensions](https://chrome.google.com/webstore/detail/point%2B/ghaddonhnchkdjaciggjijhophciboam?hl=ru)
* Установить расширение из [раздела Downloads на Bitbucket](https://bitbucket.org/skobkin/chrome_point_plus/downloads) (*.nex - Opera, *.crx - Chrome)
* Собрать самостоятельно из исходников ([Chrome](https://developer.chrome.com/extensions/packaging), [Opera](https://dev.opera.com/extensions/tut_basics.html))
### Как настраивать? ###
В адресной строке (омнибокс) появится иконка Point.im. Если на нёё нажать - появится окошко настроек.
![Настройки расширения](https://storage6.static.itmages.ru/i/14/0402/h_1396471297_3899827_5bb001cbae.png "Окно настроек расширения")
### Хочу помочь, ШТОДЕЛОЦ? ###
* Писать мне [в поинте](https://skobkin-ru.point.im/profile) или [куда-нибудь ещё](https://skobk.in/contacts/)
* Сразу присылать пулл-реквесты с шашкой наголо
* Поставить в магазинах Opera и Chrome оценку расширению
* Задонатить (см. таб Feedback в настройках)

View file

@ -1,10 +1,22 @@
var ppOptions = [ var ppOptions = [
// Fancybox // Fancybox
'option_fancybox', 'option_fancybox_images', 'option_fancybox_videos', 'option_fancybox_posts', 'option_fancybox',
// Open images in Fancybox
'option_fancybox_images',
// Open videos in Fancybox
'option_fancybox_videos',
// Open posts in Fancybox
'option_fancybox_posts',
// CTRL+Enter // CTRL+Enter
'option_ctrl_enter', 'option_ctrl_enter',
// Load original images // Load original images
'option_images_load_original', 'option_images_load_original',
// Embedding
'option_embedding',
// Load images from Gelbooru, Danbooru, etc
'option_images_load_booru',
// Wrap WEBM videos into the <video> tag
'option_videos_parse_webm',
// Fluid layout // Fluid layout
'option_fluid_layout', 'option_fluid_layout',
// Visual editor for posts // Visual editor for posts
@ -21,87 +33,42 @@ var ppOptions = [
'option_enlarge_font', 'option_enlarge_font_size', 'option_enlarge_font', 'option_enlarge_font_size',
// @ before username // @ before username
'option_at_before_username', 'option_at_before_username',
// // Highlight posts with new comments
'option_images_load_booru',
//
'option_videos_parse_webm',
//
'option_other_hightlight_post_comments', 'option_other_hightlight_post_comments',
// // Show recommendations and unique comments count
'option_other_show_recommendation_count', 'option_other_show_recommendation_count',
]; ];
// Saves options to localStorage. // Saves options to localStorage.
function pp_save_options() { function pp_save_options() {
// CTRL+Enter ppOptions = {};
var option_ctrl_enter = document.getElementById('option-ctrl-enter'); ppOptions.option_ctrl_enter = document.getElementById('option-ctrl-enter').checked;
// Fancybox ppOptions.option_fancybox = document.getElementById('option-fancybox').checked;
// ppOptions.option_fancybox_images = document.getElementById('option-fancybox-images').checked;
var option_fancybox = document.getElementById('option-fancybox'); ppOptions.option_fancybox_videos = document.getElementById('option-fancybox-videos').checked;
// Images ppOptions.option_fancybox_posts = document.getElementById('option-fancybox-posts').checked;
var option_fancybox_images = document.getElementById('option-fancybox-images'); ppOptions.option_fluid_layout = document.getElementById('option-fluid-layout').checked;
// Videos ppOptions.option_images_load_original = document.getElementById('option-images-load-original').checked;
var option_fancybox_videos = document.getElementById('option-fancybox-videos'); ppOptions.option_embedding = document.getElementById('option-embedding').checked;
// Posts ppOptions.option_images_load_booru = document.getElementById('option-images-load-booru').checked;
var option_fancybox_posts = document.getElementById('option-fancybox-posts'); ppOptions.option_videos_parse_webm = document.getElementById('option-videos-parse-webm').checked;
// Fluid layout ppOptions.option_visual_editor_post = document.getElementById('option-visual-editor-post').checked;
var option_fluid_layout = document.getElementById('option-layout-fluid'); ppOptions.checkbox_search_with_google = document.getElementById('option-search-with-google').checked;
// Load original images ppOptions.option_ws = document.getElementById('option-ws').checked;
var option_images_load_original = document.getElementById('option-images-load-original'); ppOptions.option_ws_comments = document.getElementById('option-ws-comments').checked;
// Visual editor for posts ppOptions.option_ws_comments_color_fadeout = document.getElementById('option-ws-comments-color-fadeout').checked;
var option_visual_editor_post = document.getElementById('option-visual-editor-post'); ppOptions.option_ws_comments_notifications = document.getElementById('option-ws-comments-notifications').checked;
// Google search ppOptions.option_ws_feeds = document.getElementById('option-ws-feeds').checked;
var checkbox_search_with_google = document.getElementById('option-search-with-google'); ppOptions.option_ws_feeds_subscriptions = document.getElementById('option-ws-feeds-subscriptions').checked;
// WebSocket ppOptions.option_ws_feeds_blogs = document.getElementById('option-ws-feeds-blogs').checked;
// ppOptions.option_enlarge_font = document.getElementById('option-enlarge-font').checked;
var option_ws = document.getElementById('option-ws'); ppOptions.option_enlarge_font_size = document.querySelector('input[name="pp-font-size"]:checked').value;
// Comments ppOptions.option_at_before_username = document.getElementById('option-at-before-username').checked;
var option_ws_comments = document.getElementById('option-ws-comments'); ppOptions.option_other_hightlight_post_comments = document.getElementById('option-other-hightlight-post-comments').checked;
// Fade out highlight comments ppOptions.option_other_show_recommendation_count = document.getElementById('option-other-show-recommendation-count').checked;
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');
// Saving parameters // Saving parameters
chrome.storage.sync.set({ chrome.storage.sync.set(ppOptions, function() {
'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_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() {
// 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');
status.innerHTML = 'Options Saved.'; status.innerHTML = 'Options Saved.';
@ -115,105 +82,28 @@ function pp_save_options() {
function pp_restore_options() { function pp_restore_options() {
// Loading options // Loading options
chrome.storage.sync.get(ppOptions, function(options) { chrome.storage.sync.get(ppOptions, function(options) {
// CTRL+Enter // Setting options in DOM
if (options.option_ctrl_enter == true) { $.each(options, function(key, value) {
document.getElementById('option-ctrl-enter').checked = true; var optionId = null;
}
// Fancybox
//
if (options.option_fancybox == true) {
document.getElementById('option-fancybox').checked = true;
}
// 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;
}
// 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;
}
// Visual editor for posts
if (options.option_visual_editor_post == true) {
document.getElementById('option-visual-editor-post').checked = true;
}
// Google search
if (options.option_search_with_google == true) {
document.getElementById('option-search-with-google').checked = true;
}
// WebSocket
//
if (options.option_ws == true) {
document.getElementById('option-ws').checked = true;
}
// Comments
if (options.option_ws_comments == true) {
document.getElementById('option-ws-comments').checked = true;
}
// Fade out highlight comments
if (options.option_ws_comments_color_fadeout == true) {
document.getElementById('option-ws-comments-color-fadeout').checked = true;
}
// Comments desktop notifications
// Disabling for Opera
if (/OPR/.test(navigator.userAgent)) {
document.getElementById('option-ws-comments-notifications').setAttribute('disabled', 'disabled');
}
if (options.option_ws_comments_notifications == true) {
document.getElementById('option-ws-comments-notifications').checked = true;
}
// Feeds
if (options.option_ws_feeds == true) {
document.getElementById('option-ws-feeds').checked = true;
}
// Subscriptions
if (options.option_ws_feeds_subscriptions == true) {
document.getElementById('option-ws-feeds-subscriptions').checked = true;
}
// Blogs
if (options.option_ws_feeds_blogs == 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;
}
// @ before username
if (options.option_at_before_username == true) {
document.getElementById('option-at-before-username').checked = true;
}
if (options.option_images_load_booru == true) { // Detecting option type
document.getElementById('option-images-load-booru').checked = true; if (typeof(value) == 'boolean') {
// Checkbox
optionId = '#' + key.replace(/_/g, '-');
if (value === true) {
$(optionId).first().prop('checked', true);
} }
if (options.option_videos_parse_webm == true) { } else if (typeof(value) == 'number') {
document.getElementById('option-videos-parse-webm').checked = true; // Radio select
optionId = '#' + key.replace(/_/g, '-') + '-' + value;
$(optionId).first().prop('checked', true);
} }
if (options.option_other_hightlight_post_comments == true) { });
document.getElementById('option-other-hightlight-post-comments').checked = true;
}
if (options.option_other_show_recommendation_count == true) {
document.getElementById('option-other-show-recommendation-count').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="https://skobkin-ru.point.im/" target="_blank">@skobkin-ru</a><br>\n\
& <a href="https://nokitakaze.point.im/" target="_blank">@NokitaKaze</a>';
}); });

View file

@ -36,12 +36,25 @@ $(document).ready(function() {
} }
// Posts // Posts
if (options.option_fancybox_posts == true) { if (options.option_fancybox_posts == true) {
$('.post-id a').attr('data-fancybox-type', 'iframe').fancybox({ // Excluding some sort of piece-of-shit makeup
$('.post-id a').not('#comments .post-id a, #top-post .post-id a').attr('data-fancybox-type', 'iframe').fancybox({
maxWidth: 780 maxWidth: 780
}); });
} }
} }
// Embedding
if (options.option_embedding == true) {
// Load pictures from Booru, Tumblr and some other sites
if (options.option_images_load_booru == true){
load_all_booru_images();
}
// Parse webm-links and create video instead
if (options.option_videos_parse_webm == true){
parse_webm();
}
}
// Hotkeys // Hotkeys
// Send by CTRL+Enter // Send by CTRL+Enter
if (options.option_ctrl_enter == true) { if (options.option_ctrl_enter == true) {
@ -332,14 +345,6 @@ $(document).ready(function() {
}); });
} }
// Load pictures from Booru, Tumblr and some other sites
if (options.option_images_load_booru == true){
load_all_booru_images();
}
// Parse webm-links and create video instead
if (options.option_videos_parse_webm == true){
parse_webm();
}
// Hightlight post with new comments // Hightlight post with new comments
if (options.option_other_hightlight_post_comments == true){ if (options.option_other_hightlight_post_comments == true){
mark_unread_post(); mark_unread_post();

View file

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Point+", "name": "Point+",
"version": "1.8.1", "version": "1.9.1",
"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",

View file

@ -30,7 +30,7 @@
</div> </div>
<div class="option"> <div class="option">
<input type="checkbox" id="option-fancybox-posts"><label for="option-fancybox-posts">Use for post links (including comments)</label> <input type="checkbox" id="option-fancybox-posts"><label for="option-fancybox-posts">Use for post links</label>
</div> </div>
</div> </div>
@ -38,6 +38,9 @@
<input type="checkbox" id="option-images-load-original"><label for="option-images-load-original">Load original images instead of thumbnails</label> <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">
<input type="checkbox" id="option-embedding"><label for="option-embedding">Enable embedding</label>
<div class="option"> <div class="option">
<input type="checkbox" id="option-images-load-booru"><label for="option-images-load-booru">Load pictures from Booru, Tumblr and some other sites</label> <input type="checkbox" id="option-images-load-booru"><label for="option-images-load-booru">Load pictures from Booru, Tumblr and some other sites</label>
</div> </div>
@ -47,25 +50,18 @@
</div> </div>
<div class="option"> <div class="option">
<input type="checkbox" id="option-embedding" disabled><label for="option-embedding">Enable embedding</label> <input type="checkbox" id="option-embedding-soundcloud" disabled="disabled"><label for="option-embedding-soundcloud">Soundcloud</label>
<div class="option">
<input type="checkbox" id="option-embedding-soundcloud"><label for="option-embedding-soundcloud">Soundcloud</label>
</div>
<div class="option">
<input type="checkbox" id="option-embedding-youtube" disabled><label for="option-embedding-youtube">YouTube</label>
</div> </div>
</div> </div>
</div> </div>
<div class="tab-content" id="other"> <div class="tab-content" id="other">
<div class="option"> <div class="option">
<input type="checkbox" id="option-ctrl-enter"><label for="option-ctrl-enter">Send post and comments by CTRL+Enter</label> <input type="checkbox" id="option-ctrl-enter" disabled="disabled"><label for="option-ctrl-enter">Send post and comments by CTRL+Enter (deprecated)</label>
</div> </div>
<div class="option"> <div class="option">
<input type="checkbox" id="option-layout-fluid"><label for="option-layout-fluid">Fluid layout</label> <input type="checkbox" id="option-fluid-layout"><label for="option-fluid-layout">Fluid layout</label>
</div> </div>
<div class="option"> <div class="option">
@ -112,7 +108,7 @@
</div> </div>
<div class="option"> <div class="option">
<input type="checkbox" id="option-ws-comments-notifications"><label for="option-ws-comments-notifications">Show desktop notifications (Chrome only)</label> <input type="checkbox" id="option-ws-comments-notifications"><label for="option-ws-comments-notifications">Show desktop notifications</label>
</div> </div>
</div> </div>
@ -141,9 +137,6 @@
<p> <p>
Yandex.Money: 41001539215836 Yandex.Money: 41001539215836
</p> </p>
<p>
Novacoin: 4d1ctdZtKkv3kxGdAXjfNEjfFvtDVdbf65
</p>
<p> <p>
<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WW33X5J5WFSP4" target="_blank">PayPal</a> <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WW33X5J5WFSP4" target="_blank">PayPal</a>
</p> </p>