mirror of
https://bitbucket.org/skobkin/chrome_point_plus.git
synced 2024-11-23 18:56:04 +00:00
* Другой блюр, теперь нормальный. Блюрить текст — максимум пидорство
+ По ховеру на заблюреным изображением — появляется нормальное изображение + Скроллинг между постов по пробелу + Превращаем в video все ссылки на видео и молимся * ФОРМАТИРУЕМ КОД, БЛЕАТЬ
This commit is contained in:
parent
ff51da8c3a
commit
16b86255ec
|
@ -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,6 +74,9 @@
|
||||||
"option_nsfw": {
|
"option_nsfw": {
|
||||||
"message": "NSFW content filtering"
|
"message": "NSFW content filtering"
|
||||||
},
|
},
|
||||||
|
"option_nsfw_hide_posts":{
|
||||||
|
"message": "Hide entire posts with `nsfw` tag"
|
||||||
|
},
|
||||||
"option_nsfw_blur": {
|
"option_nsfw_blur": {
|
||||||
"message": "Blurring"
|
"message": "Blurring"
|
||||||
},
|
},
|
||||||
|
@ -123,6 +129,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>"
|
||||||
|
|
|
@ -56,6 +56,9 @@
|
||||||
"option_videos_parse_webm": {
|
"option_videos_parse_webm": {
|
||||||
"message": "Оборачивать ссылки на webm в тег <video>"
|
"message": "Оборачивать ссылки на webm в тег <video>"
|
||||||
},
|
},
|
||||||
|
"option_videos_parse_all_videos": {
|
||||||
|
"message": "Оборачивать ссылки на всё видео в тег <video>"
|
||||||
|
},
|
||||||
"option_embedding_soundcloud": {
|
"option_embedding_soundcloud": {
|
||||||
"message": "Soundcloud ▼"
|
"message": "Soundcloud ▼"
|
||||||
},
|
},
|
||||||
|
@ -71,6 +74,9 @@
|
||||||
"option_nsfw": {
|
"option_nsfw": {
|
||||||
"message": "Фильтрация NSFW-контента"
|
"message": "Фильтрация NSFW-контента"
|
||||||
},
|
},
|
||||||
|
"option_nsfw_hide_posts":{
|
||||||
|
"message": "Скрывать NSFW-посты полностью"
|
||||||
|
},
|
||||||
"option_nsfw_blur": {
|
"option_nsfw_blur": {
|
||||||
"message": "Размытие небезопасных постов"
|
"message": "Размытие небезопасных постов"
|
||||||
},
|
},
|
||||||
|
@ -123,6 +129,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>"
|
||||||
|
|
|
@ -184,3 +184,19 @@ div#markItUpText-input {
|
||||||
margin-left: 0.2em;
|
margin-left: 0.2em;
|
||||||
background: #f2eceb;
|
background: #f2eceb;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* NSFW-content */
|
||||||
|
.post-tag-nsfw.hide-nsfw a.postimg img,
|
||||||
|
#comments.hide-nsfw a.postimg img{
|
||||||
|
margin-top: 5px;
|
||||||
|
-webkit-filter: blur(30px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-tag-nsfw.hide-nsfw a.postimg:hover img,
|
||||||
|
#comments.hide-nsfw a.postimg:hover img{
|
||||||
|
-webkit-filter: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.post-tag-nsfw.hide-nsfw-posts{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
|
@ -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,6 +26,7 @@ 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',
|
||||||
// Blur comments too
|
// Blur comments too
|
||||||
|
@ -51,6 +53,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,11 +71,13 @@ 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_hide_posts = $('#option-nsfw-hide-posts').prop('checked');
|
||||||
ppOptions.option_nsfw_blur = $('#option-nsfw-blur').prop('checked');
|
ppOptions.option_nsfw_blur = $('#option-nsfw-blur').prop('checked');
|
||||||
ppOptions.option_nsfw_blur_comments = $('#option-nsfw-blur-comments').prop('checked');
|
ppOptions.option_nsfw_blur_comments = $('#option-nsfw-blur-comments').prop('checked');
|
||||||
ppOptions.option_visual_editor_post = $('#option-visual-editor-post').prop('checked');
|
ppOptions.option_visual_editor_post = $('#option-visual-editor-post').prop('checked');
|
||||||
|
@ -88,6 +94,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() {
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
$(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());
|
||||||
|
|
||||||
// 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,7 +20,11 @@ $(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) {
|
||||||
parse_webm();
|
if (options.option_videos_parse_all_videos == true) {
|
||||||
|
parse_all_videos();
|
||||||
|
} else {
|
||||||
|
parse_webm();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Soundcloud
|
// Soundcloud
|
||||||
|
@ -62,7 +69,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
// Fancybox
|
// Fancybox
|
||||||
if (options.option_fancybox == true) {
|
if (options.option_fancybox == true) {
|
||||||
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('rel', 'one_flow_gallery');
|
||||||
|
@ -71,7 +78,7 @@ $(document).ready(function() {
|
||||||
|
|
||||||
// Images
|
// Images
|
||||||
if (options.option_fancybox_images == true) {
|
if (options.option_fancybox_images == true) {
|
||||||
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('rel', 'post' + idxPost);
|
||||||
|
@ -107,25 +114,23 @@ $(document).ready(function() {
|
||||||
|
|
||||||
// NSFW Filtering
|
// NSFW Filtering
|
||||||
if (options.option_nsfw == true) {
|
if (options.option_nsfw == true) {
|
||||||
// Blurred posts
|
if (options.option_nsfw_hide_posts == true) {
|
||||||
if (options.option_nsfw_blur == true) {
|
if ($('#comments').length==0) {
|
||||||
console.log('Bluring NSFW posts');
|
// @hint Поведение "галка нажата, а внутри постов НЕ блюрится, даже если нажаты все три галки" - не баг
|
||||||
|
console.log('Hide NSFW posts');
|
||||||
|
$('.post').addClass('hide-nsfw-posts');
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Blurred posts
|
||||||
|
if (options.option_nsfw_blur == true) {
|
||||||
|
console.log('Bluring NSFW posts');
|
||||||
|
$('.post').addClass('hide-nsfw');
|
||||||
|
|
||||||
$('.post').each(function() {
|
// Blurred comments
|
||||||
$(this).find('a.tag').each(function() {
|
if (options.option_nsfw_blur_comments == true) {
|
||||||
if ($(this).html().toLowerCase() == 'nsfw') {
|
$('#comments').addClass('hide-nsfw');
|
||||||
console.log('NSFW tag found!');
|
}
|
||||||
|
}
|
||||||
$(this).wrapInner('<b></b>');
|
|
||||||
$(this).parent().siblings('.text').css('-webkit-filter', 'blur(30px)');
|
|
||||||
|
|
||||||
// Blurred comments
|
|
||||||
if (options.option_nsfw_blur_comments == true) {
|
|
||||||
$('#comments').css('-webkit-filter', 'blur(30px)');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,14 +139,14 @@ $(document).ready(function() {
|
||||||
if (options.option_ctrl_enter == true) {
|
if (options.option_ctrl_enter == true) {
|
||||||
// Reply
|
// Reply
|
||||||
// Delegated event for all comments
|
// Delegated event for all comments
|
||||||
$('.content-wrap #comments').on('keydown.point_plus', '.reply-form textarea', function(e) {
|
$('.content-wrap #comments').on('keydown.point_plus', '.reply-form textarea', function (e) {
|
||||||
if (e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)) {
|
if (e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$(this).parent('.reply-form').submit();
|
$(this).parent('.reply-form').submit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// New post
|
// New post
|
||||||
$('#new-post-form #text-input,#new-post-form #tags-input').on('keydown.point_plus', function(e) {
|
$('#new-post-form #text-input,#new-post-form #tags-input').on('keydown.point_plus', function (e) {
|
||||||
if (e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)) {
|
if (e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$(this).parent('#new-post-form').submit();
|
$(this).parent('#new-post-form').submit();
|
||||||
|
@ -160,7 +165,7 @@ $(document).ready(function() {
|
||||||
// Image resizing
|
// Image resizing
|
||||||
if (options.option_images_load_original == true) {
|
if (options.option_images_load_original == true) {
|
||||||
// Setting new image source
|
// Setting new image source
|
||||||
$('.postimg:not(.youtube) img').each(function() {
|
$('.postimg:not(.youtube) img').each(function () {
|
||||||
console.log($(this).parent('.postimg').attr('href'));
|
console.log($(this).parent('.postimg').attr('href'));
|
||||||
$(this).attr('src', $(this).parent('.postimg').attr('href'));
|
$(this).attr('src', $(this).parent('.postimg').attr('href'));
|
||||||
});
|
});
|
||||||
|
@ -182,7 +187,7 @@ $(document).ready(function() {
|
||||||
// Send by CTRL+Enter
|
// Send by CTRL+Enter
|
||||||
if (options.option_ctrl_enter == true) {
|
if (options.option_ctrl_enter == true) {
|
||||||
// New post
|
// New post
|
||||||
$('#new-post-form #text-input, .post-content #text-input').on('keydown.point_plus', function(e) {
|
$('#new-post-form #text-input, .post-content #text-input').on('keydown.point_plus', function (e) {
|
||||||
if (e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)) {
|
if (e.ctrlKey && (e.keyCode == 10 || e.keyCode == 13)) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
$(this).parents('#new-post-form,#post-edit-form').submit();
|
$(this).parents('#new-post-form,#post-edit-form').submit();
|
||||||
|
@ -192,7 +197,7 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
// Google search
|
// Google search
|
||||||
if (options.option_search_with_google == true) {
|
if (options.option_search_with_google == true) {
|
||||||
$('#search-form input[type="text"]').attr('placeholder', 'Google').keydown(function(e) {
|
$('#search-form input[type="text"]').attr('placeholder', 'Google').keydown(function (e) {
|
||||||
if (e.keyCode == 10 || e.keyCode == 13) {
|
if (e.keyCode == 10 || e.keyCode == 13) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
document.location.href = '//www.google.ru/search?q=site%3Apoint.im+' + $(this).val();
|
document.location.href = '//www.google.ru/search?q=site%3Apoint.im+' + $(this).val();
|
||||||
|
@ -213,12 +218,12 @@ $(document).ready(function() {
|
||||||
console.debug('Comments view mode: %s', treeSwitch);
|
console.debug('Comments view mode: %s', treeSwitch);
|
||||||
|
|
||||||
// Error handler
|
// Error handler
|
||||||
ws.onerror = function(err) {
|
ws.onerror = function (err) {
|
||||||
console.error('WebSocket error: %O', err);
|
console.error('WebSocket error: %O', err);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Message handler
|
// Message handler
|
||||||
ws.onmessage = function(evt) {
|
ws.onmessage = function (evt) {
|
||||||
try {
|
try {
|
||||||
// ping :)
|
// ping :)
|
||||||
if (evt.data == 'ping') {
|
if (evt.data == 'ping') {
|
||||||
|
@ -265,7 +270,7 @@ $(document).ready(function() {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Loading HTML template
|
// Loading HTML template
|
||||||
$commentTemplate.load(chrome.extension.getURL('includes/comment.html'), function() {
|
$commentTemplate.load(chrome.extension.getURL('includes/comment.html'), function () {
|
||||||
// Load complete
|
// Load complete
|
||||||
console.info('comment.html loaded');
|
console.info('comment.html loaded');
|
||||||
|
|
||||||
|
@ -284,11 +289,11 @@ $(document).ready(function() {
|
||||||
console.info('Changing data in the comment element');
|
console.info('Changing data in the comment element');
|
||||||
// Date and time
|
// Date and time
|
||||||
$commentTemplate.find('.info .created')
|
$commentTemplate.find('.info .created')
|
||||||
.append($('<span>').html(((date.getDate().toString.length < 2) ? ('0' + date.getDate().toString()) : (date.getDate().toString())) + ' ' + months[date.getMonth()]))
|
.append($('<span>').html(((date.getDate().toString.length < 2) ? ('0' + date.getDate().toString()) : (date.getDate().toString())) + ' ' + months[date.getMonth()]))
|
||||||
// Crutchy fix
|
// Crutchy fix
|
||||||
.append($('<br>'))
|
.append($('<br>'))
|
||||||
///Crutchy fix
|
///Crutchy fix
|
||||||
.append($('<span>').html(date.getHours() + ':' + ((date.getMinutes().toString().length < 2) ? ('0' + date.getMinutes().toString()) : (date.getMinutes().toString()))));
|
.append($('<span>').html(date.getHours() + ':' + ((date.getMinutes().toString().length < 2) ? ('0' + date.getMinutes().toString()) : (date.getMinutes().toString()))));
|
||||||
// Comment text
|
// Comment text
|
||||||
$commentTemplate.find('.text').append($('<p>').html(escapeHtml(wsMessage.text)));
|
$commentTemplate.find('.text').append($('<p>').html(escapeHtml(wsMessage.text)));
|
||||||
// Author
|
// Author
|
||||||
|
@ -297,8 +302,8 @@ $(document).ready(function() {
|
||||||
$commentTemplate.find('.info a').attr('href', userLink).children('img.avatar').attr('src', userAvatar + '/24');
|
$commentTemplate.find('.info a').attr('href', userLink).children('img.avatar').attr('src', userAvatar + '/24');
|
||||||
// Post and comment ID's link
|
// Post and comment ID's link
|
||||||
$commentTemplate.find('.clearfix .post-id a').attr('href', commentLink).html('#' + wsMessage.post_id + '/' + wsMessage.comment_id)
|
$commentTemplate.find('.clearfix .post-id a').attr('href', commentLink).html('#' + wsMessage.post_id + '/' + wsMessage.comment_id)
|
||||||
// Adding answer label
|
// Adding answer label
|
||||||
.after((wsMessage.to_comment_id !== null) ? (' в ответ на <a href="#' + wsMessage.to_comment_id + '">/' + wsMessage.to_comment_id + '</a>') : (''));
|
.after((wsMessage.to_comment_id !== null) ? (' в ответ на <a href="#' + wsMessage.to_comment_id + '">/' + wsMessage.to_comment_id + '</a>') : (''));
|
||||||
// Setting action labels and other attributes
|
// Setting action labels and other attributes
|
||||||
$commentTemplate.find('.action-labels .reply-label').attr('for', 'reply-' + wsMessage.post_id + '_' + wsMessage.comment_id);
|
$commentTemplate.find('.action-labels .reply-label').attr('for', 'reply-' + wsMessage.post_id + '_' + wsMessage.comment_id);
|
||||||
$commentTemplate.find('.action-labels .more-label').attr('for', 'action-' + wsMessage.post_id + '_' + wsMessage.comment_id);
|
$commentTemplate.find('.action-labels .more-label').attr('for', 'action-' + wsMessage.post_id + '_' + wsMessage.comment_id);
|
||||||
|
@ -368,31 +373,31 @@ $(document).ready(function() {
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Posts
|
// Posts
|
||||||
case 'post':
|
case 'post':
|
||||||
console.group('ws-post #%s', wsMessage.post_id);
|
console.group('ws-post #%s', wsMessage.post_id);
|
||||||
|
|
||||||
console.debug(wsMessage);
|
console.debug(wsMessage);
|
||||||
|
|
||||||
console.groupEnd();
|
console.groupEnd();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Recommendation
|
// Recommendation
|
||||||
case 'ok':
|
case 'ok':
|
||||||
console.group('ws-recommendation #%s/%s', wsMessage.post_id, wsMessage.comment_id);
|
console.group('ws-recommendation #%s/%s', wsMessage.post_id, wsMessage.comment_id);
|
||||||
|
|
||||||
console.debug(wsMessage);
|
console.debug(wsMessage);
|
||||||
|
|
||||||
console.groupEnd();
|
console.groupEnd();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
console.group('ws-other');
|
console.group('ws-other');
|
||||||
|
|
||||||
console.log(wsMessage);
|
console.log(wsMessage);
|
||||||
|
|
||||||
console.groupEnd();
|
console.groupEnd();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -420,14 +425,17 @@ $(document).ready(function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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();
|
||||||
}
|
}
|
||||||
// Show recommendation count and unique commentators count
|
// Show recommendation count and unique commentators count
|
||||||
if (options.option_other_show_recommendation_count == true){
|
if (options.option_other_show_recommendation_count == true) {
|
||||||
set_posts_count_label();
|
set_posts_count_label();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (options.option_other_scroll_space_key == true){
|
||||||
|
set_space_key_skip_handler();
|
||||||
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -437,12 +445,12 @@ $(document).ready(function() {
|
||||||
|
|
||||||
function escapeHtml(text) {
|
function escapeHtml(text) {
|
||||||
return text
|
return text
|
||||||
.replace(/&/g, "&")
|
.replace(/&/g, "&")
|
||||||
.replace(/</g, "<")
|
.replace(/</g, "<")
|
||||||
//.replace(/>/g, ">")
|
//.replace(/>/g, ">")
|
||||||
.replace(/"/g, """)
|
.replace(/"/g, """)
|
||||||
.replace(/'/g, "'")
|
.replace(/'/g, "'")
|
||||||
.replace(/\n/g, "<br>");
|
.replace(/\n/g, "<br>");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Monts for Date.getMonth()
|
// Monts for Date.getMonth()
|
||||||
|
@ -580,6 +588,38 @@ 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)(\\?.+)?$', '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;';// @hint Хотя сомнительно
|
||||||
|
case 'mp4' :return 'video/mp4;';
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Плашки у постов
|
// Плашки у постов
|
||||||
function set_posts_count_label() {
|
function set_posts_count_label() {
|
||||||
var ids = [];
|
var ids = [];
|
||||||
|
@ -606,7 +646,9 @@ function set_posts_count_label() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var e1 = document.createElement('span');
|
var e1 = document.createElement('span');
|
||||||
if (typeof(answer.list[id])=='undefined'){return;}
|
if (typeof(answer.list[id]) == 'undefined') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
$(e1).addClass('authors_unique_count').html(answer.list[id].count_comment_unique).attr('title', 'Количество комментаторов');
|
$(e1).addClass('authors_unique_count').html(answer.list[id].count_comment_unique).attr('title', 'Количество комментаторов');
|
||||||
postid.appendChild(e1);
|
postid.appendChild(e1);
|
||||||
|
|
||||||
|
@ -620,11 +662,11 @@ function set_posts_count_label() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function parse_pleercom_links(){
|
function parse_pleercom_links() {
|
||||||
chrome.storage.sync.get(ppOptions, function(options) {
|
chrome.storage.sync.get(ppOptions, function (options) {
|
||||||
if (options.option_embedding_pleercom_nokita_server){
|
if (options.option_embedding_pleercom_nokita_server) {
|
||||||
parse_pleercom_links_nokita();
|
parse_pleercom_links_nokita();
|
||||||
}else{
|
} else {
|
||||||
parse_pleercom_links_ajax();
|
parse_pleercom_links_ajax();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -643,8 +685,8 @@ function parse_pleercom_links_nokita() {
|
||||||
'preload': 'none'
|
'preload': 'none'
|
||||||
});
|
});
|
||||||
|
|
||||||
var player_div=document.createElement('div');
|
var player_div = document.createElement('div');
|
||||||
$(player_div).addClass('embeded_audio').addClass('embeded_audio_'+n[1]);
|
$(player_div).addClass('embeded_audio').addClass('embeded_audio_' + n[1]);
|
||||||
player_div.appendChild(player);
|
player_div.appendChild(player);
|
||||||
|
|
||||||
obj.parentElement.insertBefore(player_div, obj);
|
obj.parentElement.insertBefore(player_div, obj);
|
||||||
|
@ -652,28 +694,28 @@ function parse_pleercom_links_nokita() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function parse_pleercom_links_ajax(){
|
function parse_pleercom_links_ajax() {
|
||||||
$('a').each(function (num, obj) {
|
$('a').each(function (num, obj) {
|
||||||
var href = obj.href;
|
var href = obj.href;
|
||||||
var n = null;
|
var n = null;
|
||||||
|
|
||||||
if (n = href.match(new RegExp('^https?:\\/\\/pleer\\.com\\/tracks\\/([0-9a-z]+)', 'i'))) {
|
if (n = href.match(new RegExp('^https?:\\/\\/pleer\\.com\\/tracks\\/([0-9a-z]+)', 'i'))) {
|
||||||
var player_div=document.createElement('div');
|
var player_div = document.createElement('div');
|
||||||
$(player_div).addClass('embeded_audio').addClass('embeded_audio_'+n[1]);
|
$(player_div).addClass('embeded_audio').addClass('embeded_audio_' + n[1]);
|
||||||
obj.parentElement.insertBefore(player_div, obj);
|
obj.parentElement.insertBefore(player_div, obj);
|
||||||
create_pleercom_ajax(n[1]);
|
create_pleercom_ajax(n[1]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function create_pleercom_ajax(id){
|
function create_pleercom_ajax(id) {
|
||||||
$ajax({
|
$ajax({
|
||||||
'url':'https://pleer.com/site_api/files/get_url',
|
'url': 'https://pleer.com/site_api/files/get_url',
|
||||||
'type':'post',
|
'type': 'post',
|
||||||
'postdata':'action=download&id='+id,
|
'postdata': 'action=download&id=' + id,
|
||||||
'dont_set_content_type':true,
|
'dont_set_content_type': true,
|
||||||
'pleer_id':id,
|
'pleer_id': id,
|
||||||
'headers':[['Accept','*'],['Content-Type','application/x-www-form-urlencoded; charset=UTF-8']],
|
'headers': [['Accept', '*'], ['Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8']],
|
||||||
'success': function (a) {
|
'success': function (a) {
|
||||||
var answer = JSON.parse(a);
|
var answer = JSON.parse(a);
|
||||||
var player = document.createElement('audio');
|
var player = document.createElement('audio');
|
||||||
|
@ -683,13 +725,63 @@ function create_pleercom_ajax(id){
|
||||||
'controls': 'controls',
|
'controls': 'controls',
|
||||||
'preload': 'auto'
|
'preload': 'auto'
|
||||||
});
|
});
|
||||||
$('.embeded_audio_'+this.settings.pleer_id)[0].appendChild(player);
|
$('.embeded_audio_' + this.settings.pleer_id)[0].appendChild(player);
|
||||||
},
|
},
|
||||||
'error':function(){
|
'error': function () {
|
||||||
console.log('Can not get url');
|
console.log('Can not get url');
|
||||||
setTimeout(new Function('create_pleercom_ajax("'+this.settings.pleer_id+'");'), 1000);
|
setTimeout(new Function('create_pleercom_ajax("' + this.settings.pleer_id + '");'), 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Проставляем теги у постов
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Point+",
|
"name": "Point+",
|
||||||
"version": "1.13.0",
|
"version": "1.14.0",
|
||||||
"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",
|
||||||
|
|
|
@ -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">
|
||||||
|
@ -73,6 +77,10 @@
|
||||||
<div class="option">
|
<div class="option">
|
||||||
<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">
|
||||||
|
<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"><label for="option-nsfw-blur" data-i18n="option_nsfw_blur"></label>
|
<input type="checkbox" id="option-nsfw-blur"><label for="option-nsfw-blur" data-i18n="option_nsfw_blur"></label>
|
||||||
|
|
||||||
|
@ -122,6 +130,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">
|
||||||
|
|
Loading…
Reference in a new issue