* Скобкинозамечания

+ Проверка, что Point+ загружается не единожды
+ Говнистый кейс заблюривания постов полностью
This commit is contained in:
Nokita Kaze 2014-11-22 15:15:22 +03:00
parent ff51da8c3a
commit 7bbbf90582
7 changed files with 313 additions and 53 deletions

View file

@ -56,6 +56,9 @@
"option_videos_parse_webm": { "option_videos_parse_webm": {
"message": "Parse webm-links and create video instead" "message": "Parse webm-links and create video instead"
}, },
"option_videos_parse_all_videos": {
"message": "Parse all links to videos and create video instead"
},
"option_embedding_soundcloud": { "option_embedding_soundcloud": {
"message": "Soundcloud ▼" "message": "Soundcloud ▼"
}, },
@ -71,11 +74,20 @@
"option_nsfw": { "option_nsfw": {
"message": "NSFW content filtering" "message": "NSFW content filtering"
}, },
"option_nsfw_blur": { "option_nsfw_hide_posts":{
"message": "Blurring" "message": "Hide posts with `nsfw` tag from feed"
}, },
"option_nsfw_blur_comments": { "option_nsfw_blur_posts_images": {
"message": "Blur comments too" "message": "Blur images in nsfw posts"
},
"option_nsfw_blur_posts_entire": {
"message": "Blur entire nsfw posts"
},
"option_nsfw_blur_comments_images": {
"message": "Blur images in comments in nsfw posts"
},
"option_nsfw_blur_comments_entire": {
"message": "Blur entire comments in nsfw posts"
}, },
"option_ctrl_enter": { "option_ctrl_enter": {
"message": "Send post and comments by CTRL+Enter (deprecated)" "message": "Send post and comments by CTRL+Enter (deprecated)"
@ -123,6 +135,9 @@
"message": "Show recommendation count and unique commentators count (using @NokitaKaze server)" "message": "Show recommendation count and unique commentators count (using @NokitaKaze server)"
}, },
"option_other_scroll_space_key":{
"message": "Scrolling posts with `space` key"
},
"options_feedback_text": { "options_feedback_text": {
"message": "<p>If you find an error do not hesitate to <a href=\"https:\/\/bitbucket.org\/skobkin\/chrome_point_plus\/issues?status=new&status=open\" target=\"_blank\">send me a bug report<\/a>.<\/p><p>Also you can make a donation in the following ways:<\/p><p><iframe frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\" src=\"https:\/\/money.yandex.ru\/embed\/small.xml?account=41001539215836&quickpay=small&yamoney-payment-type=on&button-text=04&button-size=s&button-color=black&targets=Point%2B&default-sum=150&successURL=https%3A%2F%2Fbitbucket.org%2Fskobkin%2Fchrome_point_plus\" width=\"158\" height=\"31\"><\/p><p><\/iframe><\/p><p><iframe frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\" src=\"https:\/\/money.yandex.ru\/embed\/small.xml?account=41001539215836&quickpay=small&any-card-payment-type=on&button-text=04&button-size=s&button-color=black&targets=Point%2B&default-sum=150&successURL=https%3A%2F%2Fbitbucket.org%2Fskobkin%2Fchrome_point_plus\" width=\"158\" height=\"31\"><\/iframe><\/p><p><form action=\"https:\/\/www.paypal.com\/cgi-bin\/webscr\" method=\"post\" target=\"_top\"><input type=\"hidden\" name=\"cmd\" value=\"_s-xclick\"><input type=\"hidden\" name=\"hosted_button_id\" value=\"RCW5V6UFXYTRE\"><input type=\"image\" src=\"https:\/\/www.paypalobjects.com\/ru_RU\/RU\/i\/btn\/btn_donateCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal — более безопасный и легкий способ оплаты через Интернет!\"><img alt=\"\" border=\"0\" src=\"https:\/\/www.paypalobjects.com\/en_US\/i\/scr\/pixel.gif\" width=\"1\" height=\"1\"><\/form><\/p>" "message": "<p>If you find an error do not hesitate to <a href=\"https:\/\/bitbucket.org\/skobkin\/chrome_point_plus\/issues?status=new&status=open\" target=\"_blank\">send me a bug report<\/a>.<\/p><p>Also you can make a donation in the following ways:<\/p><p><iframe frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\" src=\"https:\/\/money.yandex.ru\/embed\/small.xml?account=41001539215836&quickpay=small&yamoney-payment-type=on&button-text=04&button-size=s&button-color=black&targets=Point%2B&default-sum=150&successURL=https%3A%2F%2Fbitbucket.org%2Fskobkin%2Fchrome_point_plus\" width=\"158\" height=\"31\"><\/p><p><\/iframe><\/p><p><iframe frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\" src=\"https:\/\/money.yandex.ru\/embed\/small.xml?account=41001539215836&quickpay=small&any-card-payment-type=on&button-text=04&button-size=s&button-color=black&targets=Point%2B&default-sum=150&successURL=https%3A%2F%2Fbitbucket.org%2Fskobkin%2Fchrome_point_plus\" width=\"158\" height=\"31\"><\/iframe><\/p><p><form action=\"https:\/\/www.paypal.com\/cgi-bin\/webscr\" method=\"post\" target=\"_top\"><input type=\"hidden\" name=\"cmd\" value=\"_s-xclick\"><input type=\"hidden\" name=\"hosted_button_id\" value=\"RCW5V6UFXYTRE\"><input type=\"image\" src=\"https:\/\/www.paypalobjects.com\/ru_RU\/RU\/i\/btn\/btn_donateCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal — более безопасный и легкий способ оплаты через Интернет!\"><img alt=\"\" border=\"0\" src=\"https:\/\/www.paypalobjects.com\/en_US\/i\/scr\/pixel.gif\" width=\"1\" height=\"1\"><\/form><\/p>"

View file

@ -56,6 +56,9 @@
"option_videos_parse_webm": { "option_videos_parse_webm": {
"message": "Оборачивать ссылки на webm в тег &#60;video&#62;" "message": "Оборачивать ссылки на webm в тег &#60;video&#62;"
}, },
"option_videos_parse_all_videos": {
"message": "Оборачивать ссылки на всё видео в тег &#60;video&#62;"
},
"option_embedding_soundcloud": { "option_embedding_soundcloud": {
"message": "Soundcloud &#9660;" "message": "Soundcloud &#9660;"
}, },
@ -71,11 +74,20 @@
"option_nsfw": { "option_nsfw": {
"message": "Фильтрация NSFW-контента" "message": "Фильтрация NSFW-контента"
}, },
"option_nsfw_blur": { "option_nsfw_hide_posts":{
"message": "Размытие небезопасных постов" "message": "Скрывать NSFW-посты из ленты сообщений"
}, },
"option_nsfw_blur_comments": { "option_nsfw_blur_posts_images": {
"message": "Размытие комментариев" "message": "Размытие картинок в небезопасных постах"
},
"option_nsfw_blur_posts_entire": {
"message": "Размытие небезопасных постов полностью"
},
"option_nsfw_blur_comments_images": {
"message": "Размытие картинок в каментариях небезопасных постов"
},
"option_nsfw_blur_comments_entire": {
"message": "Размытие ВСЕХ комментариев в небезопасных постах"
}, },
"option_ctrl_enter": { "option_ctrl_enter": {
"message": "Отправлять текст по CTRL+Enter (устарело)" "message": "Отправлять текст по CTRL+Enter (устарело)"
@ -123,6 +135,10 @@
"message": "Показывать количество рекомендаций и уникальных комментаторов в посте (используя сервер @NokitaKaze)" "message": "Показывать количество рекомендаций и уникальных комментаторов в посте (используя сервер @NokitaKaze)"
}, },
"option_other_scroll_space_key":{
"message": "Скроллинг постов пробелом"
},
"options_feedback_text": { "options_feedback_text": {
"message": "<p>Нашли ошибку? Не стесняйтесь <a href=\"https:\/\/bitbucket.org\/skobkin\/chrome_point_plus\/issues?status=new&status=open\" target=\"_blank\">сообщить о ней<\/a>.<\/p><p>Также вы можете сделать пожертвование автору:<\/p><p><iframe frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\" src=\"https:\/\/money.yandex.ru\/embed\/small.xml?account=41001539215836&quickpay=small&yamoney-payment-type=on&button-text=04&button-size=s&button-color=black&targets=Point%2B&default-sum=150&successURL=https%3A%2F%2Fbitbucket.org%2Fskobkin%2Fchrome_point_plus\" width=\"158\" height=\"31\"><\/iframe><\/p><p><iframe frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\" src=\"https:\/\/money.yandex.ru\/embed\/small.xml?account=41001539215836&quickpay=small&any-card-payment-type=on&button-text=04&button-size=s&button-color=black&targets=Point%2B&default-sum=150&successURL=https%3A%2F%2Fbitbucket.org%2Fskobkin%2Fchrome_point_plus\" width=\"158\" height=\"31\"><\/iframe><\/p><p><form action=\"https:\/\/www.paypal.com\/cgi-bin\/webscr\" method=\"post\" target=\"_top\"><input type=\"hidden\" name=\"cmd\" value=\"_s-xclick\"><input type=\"hidden\" name=\"hosted_button_id\" value=\"WW33X5J5WFSP4\"><input type=\"image\" src=\"https:\/\/www.paypalobjects.com\/ru_RU\/RU\/i\/btn\/btn_donateCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal — более безопасный и легкий способ оплаты через Интернет!\"><img alt=\"\" border=\"0\" src=\"https:\/\/www.paypalobjects.com\/en_US\/i\/scr\/pixel.gif\" width=\"1\" height=\"1\"><\/form><\/p>" "message": "<p>Нашли ошибку? Не стесняйтесь <a href=\"https:\/\/bitbucket.org\/skobkin\/chrome_point_plus\/issues?status=new&status=open\" target=\"_blank\">сообщить о ней<\/a>.<\/p><p>Также вы можете сделать пожертвование автору:<\/p><p><iframe frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\" src=\"https:\/\/money.yandex.ru\/embed\/small.xml?account=41001539215836&quickpay=small&yamoney-payment-type=on&button-text=04&button-size=s&button-color=black&targets=Point%2B&default-sum=150&successURL=https%3A%2F%2Fbitbucket.org%2Fskobkin%2Fchrome_point_plus\" width=\"158\" height=\"31\"><\/iframe><\/p><p><iframe frameborder=\"0\" allowtransparency=\"true\" scrolling=\"no\" src=\"https:\/\/money.yandex.ru\/embed\/small.xml?account=41001539215836&quickpay=small&any-card-payment-type=on&button-text=04&button-size=s&button-color=black&targets=Point%2B&default-sum=150&successURL=https%3A%2F%2Fbitbucket.org%2Fskobkin%2Fchrome_point_plus\" width=\"158\" height=\"31\"><\/iframe><\/p><p><form action=\"https:\/\/www.paypal.com\/cgi-bin\/webscr\" method=\"post\" target=\"_top\"><input type=\"hidden\" name=\"cmd\" value=\"_s-xclick\"><input type=\"hidden\" name=\"hosted_button_id\" value=\"WW33X5J5WFSP4\"><input type=\"image\" src=\"https:\/\/www.paypalobjects.com\/ru_RU\/RU\/i\/btn\/btn_donateCC_LG.gif\" border=\"0\" name=\"submit\" alt=\"PayPal — более безопасный и легкий способ оплаты через Интернет!\"><img alt=\"\" border=\"0\" src=\"https:\/\/www.paypalobjects.com\/en_US\/i\/scr\/pixel.gif\" width=\"1\" height=\"1\"><\/form><\/p>"

View file

@ -173,14 +173,54 @@ div#markItUpText-input {
} }
/* Labels in post */ /* Labels in post */
.post .post-id a .authors_unique_count, .post .post-id a .recomendation_count { .post .post-id a .cn.changed_background{
}
.post .post-id a .authors_unique_count, .post .post-id a .recommendation_count {
padding: 0 .5em; padding: 0 .5em;
font-weight: normal; font-weight: normal;
color: #35587c; color: #35587c;
background: #f2f2eb; background-color: #f2f2eb;
} }
.post .post-id a .recomendation_count { .post .post-id a .recommendation_count {
margin-left: 0.2em; margin-left: 0.2em;
background: #f2eceb; background-color: #f2eceb;
}
/* NSFW-content */
.post-tag-nsfw.blur-nsfw-images a.postimg img,
.post-tag-сиськи.blur-nsfw-images a.postimg img,
#comments.blur-nsfw-images a.postimg img{
margin-top: 5px;
-webkit-filter: blur(30px);
}
.post-tag-nsfw.blur-nsfw-images a.postimg:hover img,
.post-tag-сиськи.blur-nsfw-images a.postimg:hover img,
#comments.blur-nsfw-images a.postimg:hover img{
-webkit-filter: none;
}
.post-tag-nsfw.hide-nsfw-posts,
.post-tag-сиськи.hide-nsfw-posts{
display: none;
}
.post-tag-nsfw.blur-nsfw-entire .post-content .text,
.post-tag-сиськи.blur-nsfw-entire .post-content .text,
#comments.blur-nsfw-entire .post-content .text{
-webkit-filter: blur(30px);
}
/* point-plus-debug */
.point-plus-debug{
position: absolute;
padding: 10px 20px;
top: 60px;
left: 20px;
border-radius: 3px;
border: 1px solid #333;/* @todo Сделать не такой галимый */
background-color: #ddd;/* @todo Аналогично */
z-index: 11;
} }

View file

@ -17,6 +17,7 @@ var ppOptions = [
'option_images_load_booru', 'option_images_load_booru',
// Wrap WEBM videos into the <video> tag // Wrap WEBM videos into the <video> tag
'option_videos_parse_webm', 'option_videos_parse_webm',
'option_videos_parse_all_videos',
// SoundCloud // SoundCloud
'option_embedding_soundcloud', 'option_embedding_soundcloud',
'option_embedding_soundcloud_orig_link', 'option_embedding_soundcloud_orig_link',
@ -25,10 +26,13 @@ var ppOptions = [
'option_embedding_pleercom_nokita_server', 'option_embedding_pleercom_nokita_server',
// NSFW filtering // NSFW filtering
'option_nsfw', 'option_nsfw',
'option_nsfw_hide_posts',
// Blured pictures // Blured pictures
'option_nsfw_blur', 'option_nsfw_blur_posts_images',
'option_nsfw_blur_posts_entire',
// Blur comments too // Blur comments too
'option_nsfw_blur_comments', 'option_nsfw_blur_comments_images',
'option_nsfw_blur_comments_entire',
// CTRL+Enter // CTRL+Enter
'option_ctrl_enter', 'option_ctrl_enter',
// Fluid layout // Fluid layout
@ -51,6 +55,8 @@ var ppOptions = [
'option_other_hightlight_post_comments', 'option_other_hightlight_post_comments',
// Show recommendations and unique comments count // Show recommendations and unique comments count
'option_other_show_recommendation_count', 'option_other_show_recommendation_count',
// Scrolling posts with `space` key
'option_other_scroll_space_key',
]; ];
// Saves options to localStorage. // Saves options to localStorage.
@ -67,13 +73,17 @@ function pp_save_options() {
ppOptions.option_embedding = $('#option-embedding').prop('checked'); ppOptions.option_embedding = $('#option-embedding').prop('checked');
ppOptions.option_images_load_booru = $('#option-images-load-booru').prop('checked'); ppOptions.option_images_load_booru = $('#option-images-load-booru').prop('checked');
ppOptions.option_videos_parse_webm = $('#option-videos-parse-webm').prop('checked'); ppOptions.option_videos_parse_webm = $('#option-videos-parse-webm').prop('checked');
ppOptions.option_videos_parse_all_videos = $('#option-videos-parse-all-videos').prop('checked');
ppOptions.option_embedding_soundcloud = $('#option-embedding-soundcloud').prop('checked'); ppOptions.option_embedding_soundcloud = $('#option-embedding-soundcloud').prop('checked');
ppOptions.option_embedding_soundcloud_orig_link = $('#option-embedding-soundcloud-orig-link').prop('checked'); ppOptions.option_embedding_soundcloud_orig_link = $('#option-embedding-soundcloud-orig-link').prop('checked');
ppOptions.option_embedding_pleercom = $('#option-embedding-pleercom').prop('checked'); ppOptions.option_embedding_pleercom = $('#option-embedding-pleercom').prop('checked');
ppOptions.option_embedding_pleercom_nokita_server = $('#option-embedding-pleercom-nokita-server').prop('checked'); ppOptions.option_embedding_pleercom_nokita_server = $('#option-embedding-pleercom-nokita-server').prop('checked');
ppOptions.option_nsfw = $('#option-nsfw').prop('checked'); ppOptions.option_nsfw = $('#option-nsfw').prop('checked');
ppOptions.option_nsfw_blur = $('#option-nsfw-blur').prop('checked'); ppOptions.option_nsfw_hide_posts = $('#option-nsfw-hide-posts').prop('checked');
ppOptions.option_nsfw_blur_comments = $('#option-nsfw-blur-comments').prop('checked'); ppOptions.option_nsfw_blur_posts_images = $('#option-nsfw-blur-posts-images').prop('checked');
ppOptions.option_nsfw_blur_posts_entire = $('#option-nsfw-blur-posts-entire').prop('checked');
ppOptions.option_nsfw_blur_comments_images = $('#option-nsfw-blur-comments-images').prop('checked');
ppOptions.option_nsfw_blur_comments_entire = $('#option-nsfw-blur-comments-entire').prop('checked');
ppOptions.option_visual_editor_post = $('#option-visual-editor-post').prop('checked'); ppOptions.option_visual_editor_post = $('#option-visual-editor-post').prop('checked');
ppOptions.checkbox_search_with_google = $('#option-search-with-google').prop('checked'); ppOptions.checkbox_search_with_google = $('#option-search-with-google').prop('checked');
ppOptions.option_ws = $('#option-ws').prop('checked'); ppOptions.option_ws = $('#option-ws').prop('checked');
@ -88,6 +98,8 @@ function pp_save_options() {
ppOptions.option_at_before_username = $('#option-at-before-username').prop('checked'); ppOptions.option_at_before_username = $('#option-at-before-username').prop('checked');
ppOptions.option_other_hightlight_post_comments = $('#option-other-hightlight-post-comments').prop('checked'); ppOptions.option_other_hightlight_post_comments = $('#option-other-hightlight-post-comments').prop('checked');
ppOptions.option_other_show_recommendation_count = $('#option-other-show-recommendation-count').prop('checked'); ppOptions.option_other_show_recommendation_count = $('#option-other-show-recommendation-count').prop('checked');
ppOptions.option_other_scroll_space_key = $('#option-other-scroll-space-key').prop('checked');
// Saving parameters // Saving parameters
chrome.storage.sync.set(ppOptions, function() { chrome.storage.sync.set(ppOptions, function() {

View file

@ -1,14 +1,29 @@
$(document).ready(function() { $(document).ready(function() {
// Grouping console log // Grouping console log
console.group('point-plus'); console.group('point-plus');
console.info('Point+ %s', getVersion()); console.info('Point+ %s', getVersion());
// Проверяем, загрузились ли мы
var point_plus_debug=$('.point-plus-debug');
if (point_plus_debug.length>0){
console.info('Point+ already loaded, version: %s', point_plus_debug.attr('data-point-plus-version'));
return;
}
point_plus_debug=null;
var new_div=document.createElement('div');
document.body.appendChild(new_div);
$(new_div).attr({
'data-point-plus-version':getVersion()
}).addClass('point-plus-debug').html('Point+ v'+getVersion()+' loading...');
new_div=null;
// Loading options // Loading options
chrome.storage.sync.get(ppOptions, function(options) { chrome.storage.sync.get(ppOptions, function(options) {
// Options debug // Options debug
console.debug('Options loaded: %O', options); console.debug('Options loaded: %O', options);
create_tag_system();
// Embedding // Embedding
if (options.option_embedding == true) { if (options.option_embedding == true) {
// Load pictures from Booru, Tumblr and some other sites // Load pictures from Booru, Tumblr and some other sites
@ -17,8 +32,12 @@ $(document).ready(function() {
} }
// Parse webm-links and create video instead // Parse webm-links and create video instead
if (options.option_videos_parse_webm == true) { if (options.option_videos_parse_webm == true) {
if (options.option_videos_parse_all_videos == true) {
parse_all_videos();
} else {
parse_webm(); parse_webm();
} }
}
// Soundcloud // Soundcloud
if (options.option_embedding_soundcloud == true) { if (options.option_embedding_soundcloud == true) {
@ -65,7 +84,7 @@ $(document).ready(function() {
if (options.option_fancybox_bind_images_to_one_flow==true){ if (options.option_fancybox_bind_images_to_one_flow==true){
// Linking images in posts to the galleries // Linking images in posts to the galleries
$('.post-content .text').each(function () { $('.post-content .text').each(function () {
$(this).find('a.postimg:not(.youtube)').attr('rel', 'one_flow_gallery'); $(this).find('a.postimg:not(.youtube)').attr('data-fancybox-group', 'one_flow_gallery');
}); });
} }
@ -74,7 +93,7 @@ $(document).ready(function() {
if (options.option_fancybox_bind_images_to_one_flow!==true) { if (options.option_fancybox_bind_images_to_one_flow!==true) {
// Linking images in posts to the galleries // Linking images in posts to the galleries
$('.post-content .text').each(function (idxPost) { $('.post-content .text').each(function (idxPost) {
$(this).find('a.postimg:not(.youtube)').attr('rel', 'post' + idxPost); $(this).find('a.postimg:not(.youtube)').attr('data-fancybox-group', 'post' + idxPost);
}); });
} }
// Init fancybox // Init fancybox
@ -82,6 +101,50 @@ $(document).ready(function() {
type: 'image' type: 'image'
}); });
} }
// Правим хинт в FancyBox
$('.post').each(function () {
var all_post_images = $(this).find('.postimg');
if (all_post_images.length == 0) {
return;
}
var tags = $(this).find('div.tags a.tag');
var hint_text = '';// Текст для хинта в FancyBox
// Сначала теги
for (var i = 0; i < tags.length; i++) {
var tag_name = $(tags[i]).html().toLowerCase();
hint_text += ' ' + tag_name;
}
// Потом текст
var textcontent = $(this).find('.text-content');
if (textcontent.length > 0) {
textcontent = textcontent[0];
for (var i = 0; i < textcontent.childNodes.length; i++) {
var current_child_node = textcontent.childNodes[i];
if ((current_child_node.nodeName !== 'P') && (current_child_node.nodeName !== '#text')) {
continue;
}
var a = $(current_child_node).find('a.postimg');
if (a.length > 0) {
continue;
}
var tmp_str = current_child_node.textContent.replace(/(\n(\r)?)/g, ' ');
tmp_str = tmp_str.replace("\t", " ");
hint_text += ' ' + tmp_str;
}
}
// Режем
hint_text = hint_text.replace(new RegExp(' {2,}'), ' ').replace(new RegExp(' +$'), '').substr(1);
if (hint_text.length > 140) {
hint_text = hint_text.substr(0, 140 - 3) + '...';
}
all_post_images.attr('data-fancybox-title', hint_text);
});
// Videos // Videos
if (options.option_fancybox_videos == true) { if (options.option_fancybox_videos == true) {
$('.postimg.youtube').addClass('fancybox-media').fancybox({ $('.postimg.youtube').addClass('fancybox-media').fancybox({
@ -107,26 +170,35 @@ $(document).ready(function() {
// NSFW Filtering // NSFW Filtering
if (options.option_nsfw == true) { if (options.option_nsfw == true) {
$('.post-tag-nsfw,.post-tag-сиськи').find('a.postimg:not(.youtube)').attr('data-fancybox-group', 'hidden-images');
if (options.option_nsfw_hide_posts == true) {
if ($('#comments').length == 0) {
console.log('Hide NSFW posts in feed');
$('.post').addClass('hide-nsfw-posts');
}
} else {
// Blurred posts // Blurred posts
if (options.option_nsfw_blur == true) { if (options.option_nsfw_blur_posts_entire == true) {
console.log('Bluring NSFW posts'); console.log('Bluring NSFW posts');
$('.post').addClass('blur-nsfw-entire');
$('.post').each(function() { } else if (options.option_nsfw_blur_posts_images == true) {
$(this).find('a.tag').each(function() { console.log('Bluring images in NSFW posts');
if ($(this).html().toLowerCase() == 'nsfw') { $('.post').addClass('blur-nsfw-images');
console.log('NSFW tag found!'); }
}
$(this).wrapInner('<b></b>');
$(this).parent().siblings('.text').css('-webkit-filter', 'blur(30px)');
// Blurred comments // Blurred comments
if (options.option_nsfw_blur_comments == true) { if ($('.post').hasClass('post-tag-nsfw') || $('.post').hasClass('post-tag-сиськи')) {
$('#comments').css('-webkit-filter', 'blur(30px)'); if (options.option_nsfw_blur_comments_entire == true) {
console.log('Bluring comments');
$('#comments').addClass('blur-nsfw-entire');
} else if (options.option_nsfw_blur_comments_images == true) {
// @hint Никита Ветров официально складывает с себя все претензии, если у кого-то от этого говна упадёт драйвер видео-карты
console.log('Bluring images in comments');
$('#comments').addClass('blur-nsfw-images');
} }
} }
});
});
}
} }
// Hotkeys // Hotkeys
@ -427,8 +499,12 @@ $(document).ready(function() {
if (options.option_other_show_recommendation_count == true){ if (options.option_other_show_recommendation_count == true){
set_posts_count_label(); set_posts_count_label();
} }
// `Space` key scroll handler
if (options.option_other_scroll_space_key == true){
set_space_key_skip_handler();
}
$('.point-plus-debug').fadeOut(500);
}); });
// Showing page action // Showing page action
@ -452,7 +528,6 @@ var months = [
]; ];
/* Nokita's functions */
// Картинки с бурятников // Картинки с бурятников
var booru_picture_count = 0; var booru_picture_count = 0;
function load_all_booru_images() { function load_all_booru_images() {
@ -541,7 +616,7 @@ function create_image(domain, id, additional) {
return a; return a;
} }
/* point */ // Помечаем непрочитанные посты более видимо чем каким-то баджем
// Эта часть написана @RainbowSpike // Эта часть написана @RainbowSpike
function mark_unread_post() { function mark_unread_post() {
var divs = $(".post"); // массив постов var divs = $(".post"); // массив постов
@ -580,6 +655,39 @@ function parse_webm() {
}); });
} }
function parse_all_videos() {
$('a').each(function (num, obj) {
if ($(obj).hasClass('booru_pic')) {
return;
}
var href = obj.href;
var n = null;
if (n = href.match(new RegExp('\\.(webm|avi|mp4|mpg|mpeg)(\\?.+)?$', 'i'))) {
var player = document.createElement('video');
var mime = video_extension_to_mime(n[1]);
$(player).html('<source src="' + href + '" type=\'' + mime + '"\' />').attr('controls', 'controls').css({
'display': 'block',
'max-width': '95%'
}).addClass('parsed-webm-link');
obj.parentElement.insertBefore(player, obj);
}
});
}
function video_extension_to_mime(extension) {
switch(extension){
case 'webm':return 'video/webm; codecs="vp8, vorbis';
case 'avi' :return 'video/avi;';
case 'mp4' :return 'video/mp4;';
case 'mpg' :return 'video/mp4;';
case 'mpeg':return 'video/mp4;';
}
}
// Плашки у постов // Плашки у постов
function set_posts_count_label() { function set_posts_count_label() {
var ids = []; var ids = [];
@ -611,7 +719,7 @@ function set_posts_count_label() {
postid.appendChild(e1); postid.appendChild(e1);
var e2 = document.createElement('span'); var e2 = document.createElement('span');
$(e2).addClass('recomendation_count').html('~' + answer.list[id].count_recommendation).attr('title', 'Количество рекомендаций. Работает криво, спасибо @arts\'у за это'); $(e2).addClass('recommendation_count').html('~' + answer.list[id].count_recommendation).attr('title', 'Количество рекомендаций. Работает криво, спасибо @arts\'у за это');
postid.appendChild(e2); postid.appendChild(e2);
}); });
} }
@ -693,3 +801,53 @@ function create_pleercom_ajax(id){
}); });
} }
// Проставляем теги у постов
function create_tag_system() {
$('.post').each(function () {
var tags = $(this).find('div.tags a.tag');
for (var i = 0; i < tags.length; i++) {
var tag_name = $(tags[i]).html().toLowerCase();
$(this).addClass('post-tag-' + tag_name);
}
});
}
// Скролл по пробелу
function set_space_key_skip_handler() {
if ($('#comments').length > 0) {
return;
}
// @todo Свериться с Best-practice биндинга функций. Мб там on или bind
$(document.body).keydown(function (e) {
// @todo Я хотел по отпусканию кнопки, но там уже скролл срабатывает
// проверяем фокус
if ($(':focus').length > 0) {
return;
}
var k = event.keyCode;
if (k == 32) {
space_key_event();
return false;
}
});
}
function space_key_event() {
var scroll_current = $('body').scrollTop();
var scroll_step_size = 0;
var scroll_real = Math.max(scroll_current - scroll_step_size, 0);
var posts = $('.post');
for (var i = 0; i < posts.length; i++) {
var this_top_px = $(posts[i]).offset().top;
if (this_top_px > scroll_real) {
$('body').animate({
'scrollTop': this_top_px
}, 200);
return;
}
}
}

View file

@ -1,7 +1,7 @@
{ {
"manifest_version": 2, "manifest_version": 2,
"name": "Point+", "name": "Point+",
"version": "1.13.0", "version": "1.14.2",
"default_locale": "ru", "default_locale": "ru",
"author": "__MSG_ext_author__", "author": "__MSG_ext_author__",
"homepage_url": "https://bitbucket.org/skobkin/chrome_point_plus", "homepage_url": "https://bitbucket.org/skobkin/chrome_point_plus",

View file

@ -51,6 +51,10 @@
<div class="option"> <div class="option">
<input type="checkbox" id="option-videos-parse-webm"><label for="option-videos-parse-webm" data-i18n="option_videos_parse_webm"></label> <input type="checkbox" id="option-videos-parse-webm"><label for="option-videos-parse-webm" data-i18n="option_videos_parse_webm"></label>
<div class="option">
<input type="checkbox" id="option-videos-parse-all-videos"><label for="option-videos-parse-all-videos" data-i18n="option_videos_parse_all_videos"></label>
</div>
</div> </div>
<div class="option"> <div class="option">
@ -74,10 +78,22 @@
<input type="checkbox" id="option-nsfw"><label for="option-nsfw" data-i18n="option_nsfw"></label> <input type="checkbox" id="option-nsfw"><label for="option-nsfw" data-i18n="option_nsfw"></label>
<div class="option"> <div class="option">
<input type="checkbox" id="option-nsfw-blur"><label for="option-nsfw-blur" data-i18n="option_nsfw_blur"></label> <input type="checkbox" id="option-nsfw-hide-posts"><label for="option-nsfw-hide-posts" data-i18n="option_nsfw_hide_posts"></label>
</div>
<div class="option"> <div class="option">
<input type="checkbox" id="option-nsfw-blur-comments"><label for="option-nsfw-blur-comments" data-i18n="option_nsfw_blur_comments"></label> <input type="checkbox" id="option-nsfw-blur-posts-images"><label for="option-nsfw-blur-posts-images" data-i18n="option_nsfw_blur_posts_images"></label>
<div class="option">
<input type="checkbox" id="option-nsfw-blur-posts-entire"><label for="option-nsfw-blur-posts-entire" data-i18n="option_nsfw_blur_posts_entire"></label>
</div>
</div>
<div class="option">
<input type="checkbox" id="option-nsfw-blur-comments-images"><label for="option-nsfw-blur-comments-images" data-i18n="option_nsfw_blur_comments_images"></label>
<div class="option">
<input type="checkbox" id="option-nsfw-blur-comments-entire"><label for="option-nsfw-blur-comments-entire" data-i18n="option_nsfw_blur_comments_entire"></label>
</div> </div>
</div> </div>
</div> </div>
@ -122,6 +138,9 @@
<input type="checkbox" id="option-other-show-recommendation-count"><label for="option-other-show-recommendation-count" data-i18n="option_other_show_recommendation_count"></label> <input type="checkbox" id="option-other-show-recommendation-count"><label for="option-other-show-recommendation-count" data-i18n="option_other_show_recommendation_count"></label>
</div> </div>
<div class="option">
<input type="checkbox" id="option-other-scroll-space-key"><label for="option-other-scroll-space-key" data-i18n="option_other_scroll_space_key"></label>
</div>
</div> </div>
<div class="tab-content" id="websocket"> <div class="tab-content" id="websocket">