mirror of
https://bitbucket.org/skobkin/chrome_point_plus.git
synced 2024-12-28 17:24:20 +00:00
* Другой блюр, теперь нормальный. Блюрить текст — максимум пидорство
+ По ховеру на заблюреным изображением — появляется нормальное изображение + Скроллинг между постов по пробелу + Превращаем в video все ссылки на видео и молимся * ФОРМАТИРУЕМ КОД, БЛЕАТЬ
This commit is contained in:
parent
ff51da8c3a
commit
16b86255ec
|
@ -56,6 +56,9 @@
|
|||
"option_videos_parse_webm": {
|
||||
"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": {
|
||||
"message": "Soundcloud ▼"
|
||||
},
|
||||
|
@ -71,6 +74,9 @@
|
|||
"option_nsfw": {
|
||||
"message": "NSFW content filtering"
|
||||
},
|
||||
"option_nsfw_hide_posts":{
|
||||
"message": "Hide entire posts with `nsfw` tag"
|
||||
},
|
||||
"option_nsfw_blur": {
|
||||
"message": "Blurring"
|
||||
},
|
||||
|
@ -122,7 +128,10 @@
|
|||
"option_other_show_recommendation_count": {
|
||||
"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": {
|
||||
"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": {
|
||||
"message": "Оборачивать ссылки на webm в тег <video>"
|
||||
},
|
||||
"option_videos_parse_all_videos": {
|
||||
"message": "Оборачивать ссылки на всё видео в тег <video>"
|
||||
},
|
||||
"option_embedding_soundcloud": {
|
||||
"message": "Soundcloud ▼"
|
||||
},
|
||||
|
@ -71,6 +74,9 @@
|
|||
"option_nsfw": {
|
||||
"message": "Фильтрация NSFW-контента"
|
||||
},
|
||||
"option_nsfw_hide_posts":{
|
||||
"message": "Скрывать NSFW-посты полностью"
|
||||
},
|
||||
"option_nsfw_blur": {
|
||||
"message": "Размытие небезопасных постов"
|
||||
},
|
||||
|
@ -122,8 +128,12 @@
|
|||
"option_other_show_recommendation_count": {
|
||||
"message": "Показывать количество рекомендаций и уникальных комментаторов в посте (используя сервер @NokitaKaze)"
|
||||
},
|
||||
|
||||
|
||||
|
||||
"option_other_scroll_space_key":{
|
||||
"message": "Скроллинг постов пробелом"
|
||||
},
|
||||
|
||||
|
||||
"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>"
|
||||
}
|
||||
|
|
|
@ -184,3 +184,19 @@ div#markItUpText-input {
|
|||
margin-left: 0.2em;
|
||||
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',
|
||||
// Wrap WEBM videos into the <video> tag
|
||||
'option_videos_parse_webm',
|
||||
'option_videos_parse_all_videos',
|
||||
// SoundCloud
|
||||
'option_embedding_soundcloud',
|
||||
'option_embedding_soundcloud_orig_link',
|
||||
|
@ -25,6 +26,7 @@ var ppOptions = [
|
|||
'option_embedding_pleercom_nokita_server',
|
||||
// NSFW filtering
|
||||
'option_nsfw',
|
||||
'option_nsfw_hide_posts',
|
||||
// Blured pictures
|
||||
'option_nsfw_blur',
|
||||
// Blur comments too
|
||||
|
@ -51,6 +53,8 @@ var ppOptions = [
|
|||
'option_other_hightlight_post_comments',
|
||||
// Show recommendations and unique comments count
|
||||
'option_other_show_recommendation_count',
|
||||
// Scrolling posts with `space` key
|
||||
'option_other_scroll_space_key',
|
||||
];
|
||||
|
||||
// Saves options to localStorage.
|
||||
|
@ -67,11 +71,13 @@ function pp_save_options() {
|
|||
ppOptions.option_embedding = $('#option-embedding').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_all_videos = $('#option-videos-parse-all-videos').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_pleercom = $('#option-embedding-pleercom').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_hide_posts = $('#option-nsfw-hide-posts').prop('checked');
|
||||
ppOptions.option_nsfw_blur = $('#option-nsfw-blur').prop('checked');
|
||||
ppOptions.option_nsfw_blur_comments = $('#option-nsfw-blur-comments').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_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_scroll_space_key = $('#option-other-scroll-space-key').prop('checked');
|
||||
|
||||
|
||||
// Saving parameters
|
||||
chrome.storage.sync.set(ppOptions, function() {
|
||||
|
|
|
@ -1,14 +1,17 @@
|
|||
$(document).ready(function() {
|
||||
$(document).ready(function () {
|
||||
// Grouping console log
|
||||
console.group('point-plus');
|
||||
|
||||
console.info('Point+ %s', getVersion());
|
||||
|
||||
// Loading options
|
||||
chrome.storage.sync.get(ppOptions, function(options) {
|
||||
chrome.storage.sync.get(ppOptions, function (options) {
|
||||
// Options debug
|
||||
console.debug('Options loaded: %O', options);
|
||||
|
||||
create_tag_system();
|
||||
|
||||
|
||||
// Embedding
|
||||
if (options.option_embedding == true) {
|
||||
// Load pictures from Booru, Tumblr and some other sites
|
||||
|
@ -17,7 +20,11 @@ $(document).ready(function() {
|
|||
}
|
||||
// Parse webm-links and create video instead
|
||||
if (options.option_videos_parse_webm == true) {
|
||||
parse_webm();
|
||||
if (options.option_videos_parse_all_videos == true) {
|
||||
parse_all_videos();
|
||||
} else {
|
||||
parse_webm();
|
||||
}
|
||||
}
|
||||
|
||||
// Soundcloud
|
||||
|
@ -62,7 +69,7 @@ $(document).ready(function() {
|
|||
|
||||
// Fancybox
|
||||
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
|
||||
$('.post-content .text').each(function () {
|
||||
$(this).find('a.postimg:not(.youtube)').attr('rel', 'one_flow_gallery');
|
||||
|
@ -71,7 +78,7 @@ $(document).ready(function() {
|
|||
|
||||
// Images
|
||||
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
|
||||
$('.post-content .text').each(function (idxPost) {
|
||||
$(this).find('a.postimg:not(.youtube)').attr('rel', 'post' + idxPost);
|
||||
|
@ -104,44 +111,42 @@ $(document).ready(function() {
|
|||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// NSFW Filtering
|
||||
if (options.option_nsfw == true) {
|
||||
// Blurred posts
|
||||
if (options.option_nsfw_blur == true) {
|
||||
console.log('Bluring NSFW posts');
|
||||
|
||||
$('.post').each(function() {
|
||||
$(this).find('a.tag').each(function() {
|
||||
if ($(this).html().toLowerCase() == '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)');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
if (options.option_nsfw_hide_posts == true) {
|
||||
if ($('#comments').length==0) {
|
||||
// @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');
|
||||
|
||||
// Blurred comments
|
||||
if (options.option_nsfw_blur_comments == true) {
|
||||
$('#comments').addClass('hide-nsfw');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Hotkeys
|
||||
// Send by CTRL+Enter
|
||||
if (options.option_ctrl_enter == true) {
|
||||
// Reply
|
||||
// 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)) {
|
||||
e.preventDefault();
|
||||
$(this).parent('.reply-form').submit();
|
||||
}
|
||||
});
|
||||
// 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)) {
|
||||
e.preventDefault();
|
||||
$(this).parent('#new-post-form').submit();
|
||||
|
@ -160,7 +165,7 @@ $(document).ready(function() {
|
|||
// Image resizing
|
||||
if (options.option_images_load_original == true) {
|
||||
// Setting new image source
|
||||
$('.postimg:not(.youtube) img').each(function() {
|
||||
$('.postimg:not(.youtube) img').each(function () {
|
||||
console.log($(this).parent('.postimg').attr('href'));
|
||||
$(this).attr('src', $(this).parent('.postimg').attr('href'));
|
||||
});
|
||||
|
@ -182,7 +187,7 @@ $(document).ready(function() {
|
|||
// Send by CTRL+Enter
|
||||
if (options.option_ctrl_enter == true) {
|
||||
// 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)) {
|
||||
e.preventDefault();
|
||||
$(this).parents('#new-post-form,#post-edit-form').submit();
|
||||
|
@ -192,7 +197,7 @@ $(document).ready(function() {
|
|||
}
|
||||
// Google search
|
||||
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) {
|
||||
e.preventDefault();
|
||||
document.location.href = '//www.google.ru/search?q=site%3Apoint.im+' + $(this).val();
|
||||
|
@ -204,21 +209,21 @@ $(document).ready(function() {
|
|||
// SSL or plain
|
||||
ws = new WebSocket(((location.protocol == 'https:') ? 'wss' : 'ws') + '://point.im/ws');
|
||||
console.log('WebSocket created: %O', ws);
|
||||
|
||||
|
||||
// Detecting post id if presented
|
||||
var postId = $('#top-post').attr('data-id');
|
||||
console.debug('Current post id detected as #%s', postId);
|
||||
// Detecting view mode
|
||||
treeSwitch = $('#tree-switch a.active').attr('href');
|
||||
console.debug('Comments view mode: %s', treeSwitch);
|
||||
|
||||
|
||||
// Error handler
|
||||
ws.onerror = function(err) {
|
||||
ws.onerror = function (err) {
|
||||
console.error('WebSocket error: %O', err);
|
||||
};
|
||||
|
||||
|
||||
// Message handler
|
||||
ws.onmessage = function(evt) {
|
||||
ws.onmessage = function (evt) {
|
||||
try {
|
||||
// ping :)
|
||||
if (evt.data == 'ping') {
|
||||
|
@ -246,14 +251,14 @@ $(document).ready(function() {
|
|||
console.groupEnd();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
// Check we are in specified post
|
||||
if (wsMessage.post_id != postId) {
|
||||
console.log('The comment is for #%s but current page is for #%s', wsMessage.post_id, postId);
|
||||
console.groupEnd();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
var $anchor = $('<a>').attr('name', wsMessage.comment_id);
|
||||
|
||||
// Initializing comment element
|
||||
|
@ -265,7 +270,7 @@ $(document).ready(function() {
|
|||
});
|
||||
|
||||
// Loading HTML template
|
||||
$commentTemplate.load(chrome.extension.getURL('includes/comment.html'), function() {
|
||||
$commentTemplate.load(chrome.extension.getURL('includes/comment.html'), function () {
|
||||
// Load complete
|
||||
console.info('comment.html loaded');
|
||||
|
||||
|
@ -284,11 +289,11 @@ $(document).ready(function() {
|
|||
console.info('Changing data in the comment element');
|
||||
// Date and time
|
||||
$commentTemplate.find('.info .created')
|
||||
.append($('<span>').html(((date.getDate().toString.length < 2) ? ('0' + date.getDate().toString()) : (date.getDate().toString())) + ' ' + months[date.getMonth()]))
|
||||
// Crutchy fix
|
||||
.append($('<br>'))
|
||||
///Crutchy fix
|
||||
.append($('<span>').html(date.getHours() + ':' + ((date.getMinutes().toString().length < 2) ? ('0' + date.getMinutes().toString()) : (date.getMinutes().toString()))));
|
||||
.append($('<span>').html(((date.getDate().toString.length < 2) ? ('0' + date.getDate().toString()) : (date.getDate().toString())) + ' ' + months[date.getMonth()]))
|
||||
// Crutchy fix
|
||||
.append($('<br>'))
|
||||
///Crutchy fix
|
||||
.append($('<span>').html(date.getHours() + ':' + ((date.getMinutes().toString().length < 2) ? ('0' + date.getMinutes().toString()) : (date.getMinutes().toString()))));
|
||||
// Comment text
|
||||
$commentTemplate.find('.text').append($('<p>').html(escapeHtml(wsMessage.text)));
|
||||
// Author
|
||||
|
@ -297,8 +302,8 @@ $(document).ready(function() {
|
|||
$commentTemplate.find('.info a').attr('href', userLink).children('img.avatar').attr('src', userAvatar + '/24');
|
||||
// Post and comment ID's link
|
||||
$commentTemplate.find('.clearfix .post-id a').attr('href', commentLink).html('#' + wsMessage.post_id + '/' + wsMessage.comment_id)
|
||||
// Adding answer label
|
||||
.after((wsMessage.to_comment_id !== null) ? (' в ответ на <a href="#' + wsMessage.to_comment_id + '">/' + wsMessage.to_comment_id + '</a>') : (''));
|
||||
// Adding answer label
|
||||
.after((wsMessage.to_comment_id !== null) ? (' в ответ на <a href="#' + wsMessage.to_comment_id + '">/' + wsMessage.to_comment_id + '</a>') : (''));
|
||||
// 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 .more-label').attr('for', 'action-' + wsMessage.post_id + '_' + wsMessage.comment_id);
|
||||
|
@ -344,13 +349,13 @@ $(document).ready(function() {
|
|||
|
||||
// Adding anchor
|
||||
$commentTemplate.before($anchor);
|
||||
|
||||
|
||||
// Fading out highlight if needed
|
||||
if (options.option_ws_comments_color_fadeout == true) {
|
||||
console.log('Fading out the highlight');
|
||||
$commentTemplate.children('.pp-highlight').fadeOut(20000);
|
||||
}
|
||||
|
||||
|
||||
// Desktop notifications
|
||||
if (options.option_ws_comments_notifications == true) {
|
||||
console.log('Showing desktop notification');
|
||||
|
@ -362,38 +367,38 @@ $(document).ready(function() {
|
|||
text: wsMessage.text
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
console.groupEnd();
|
||||
});
|
||||
|
||||
|
||||
break;
|
||||
|
||||
// Posts
|
||||
case 'post':
|
||||
console.group('ws-post #%s', wsMessage.post_id);
|
||||
|
||||
console.debug(wsMessage);
|
||||
|
||||
console.groupEnd();
|
||||
break;
|
||||
|
||||
// Recommendation
|
||||
case 'ok':
|
||||
console.group('ws-recommendation #%s/%s', wsMessage.post_id, wsMessage.comment_id);
|
||||
|
||||
console.debug(wsMessage);
|
||||
|
||||
console.groupEnd();
|
||||
break;
|
||||
|
||||
default:
|
||||
console.group('ws-other');
|
||||
|
||||
console.log(wsMessage);
|
||||
|
||||
console.groupEnd();
|
||||
break;
|
||||
|
||||
// Posts
|
||||
case 'post':
|
||||
console.group('ws-post #%s', wsMessage.post_id);
|
||||
|
||||
console.debug(wsMessage);
|
||||
|
||||
console.groupEnd();
|
||||
break;
|
||||
|
||||
// Recommendation
|
||||
case 'ok':
|
||||
console.group('ws-recommendation #%s/%s', wsMessage.post_id, wsMessage.comment_id);
|
||||
|
||||
console.debug(wsMessage);
|
||||
|
||||
console.groupEnd();
|
||||
break;
|
||||
|
||||
default:
|
||||
console.group('ws-other');
|
||||
|
||||
console.log(wsMessage);
|
||||
|
||||
console.groupEnd();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -406,7 +411,7 @@ $(document).ready(function() {
|
|||
}
|
||||
;
|
||||
};
|
||||
}
|
||||
}
|
||||
// Font size
|
||||
if ((options.option_enlarge_font == true) && (options.option_enlarge_font_size !== undefined)) {
|
||||
$('body').css('font-size', (options.option_enlarge_font_size / 100) + 'em');
|
||||
|
@ -420,14 +425,17 @@ $(document).ready(function() {
|
|||
}
|
||||
|
||||
// Hightlight post with new comments
|
||||
if (options.option_other_hightlight_post_comments == true){
|
||||
if (options.option_other_hightlight_post_comments == true) {
|
||||
mark_unread_post();
|
||||
}
|
||||
// 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();
|
||||
}
|
||||
|
||||
if (options.option_other_scroll_space_key == true){
|
||||
set_space_key_skip_handler();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
@ -437,12 +445,12 @@ $(document).ready(function() {
|
|||
|
||||
function escapeHtml(text) {
|
||||
return text
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
//.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'")
|
||||
.replace(/\n/g, "<br>");
|
||||
.replace(/&/g, "&")
|
||||
.replace(/</g, "<")
|
||||
//.replace(/>/g, ">")
|
||||
.replace(/"/g, """)
|
||||
.replace(/'/g, "'")
|
||||
.replace(/\n/g, "<br>");
|
||||
}
|
||||
|
||||
// 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() {
|
||||
var ids = [];
|
||||
|
@ -606,7 +646,9 @@ function set_posts_count_label() {
|
|||
}
|
||||
|
||||
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', 'Количество комментаторов');
|
||||
postid.appendChild(e1);
|
||||
|
||||
|
@ -620,11 +662,11 @@ function set_posts_count_label() {
|
|||
|
||||
}
|
||||
|
||||
function parse_pleercom_links(){
|
||||
chrome.storage.sync.get(ppOptions, function(options) {
|
||||
if (options.option_embedding_pleercom_nokita_server){
|
||||
function parse_pleercom_links() {
|
||||
chrome.storage.sync.get(ppOptions, function (options) {
|
||||
if (options.option_embedding_pleercom_nokita_server) {
|
||||
parse_pleercom_links_nokita();
|
||||
}else{
|
||||
} else {
|
||||
parse_pleercom_links_ajax();
|
||||
}
|
||||
});
|
||||
|
@ -643,8 +685,8 @@ function parse_pleercom_links_nokita() {
|
|||
'preload': 'none'
|
||||
});
|
||||
|
||||
var player_div=document.createElement('div');
|
||||
$(player_div).addClass('embeded_audio').addClass('embeded_audio_'+n[1]);
|
||||
var player_div = document.createElement('div');
|
||||
$(player_div).addClass('embeded_audio').addClass('embeded_audio_' + n[1]);
|
||||
player_div.appendChild(player);
|
||||
|
||||
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) {
|
||||
var href = obj.href;
|
||||
var n = null;
|
||||
|
||||
if (n = href.match(new RegExp('^https?:\\/\\/pleer\\.com\\/tracks\\/([0-9a-z]+)', 'i'))) {
|
||||
var player_div=document.createElement('div');
|
||||
$(player_div).addClass('embeded_audio').addClass('embeded_audio_'+n[1]);
|
||||
var player_div = document.createElement('div');
|
||||
$(player_div).addClass('embeded_audio').addClass('embeded_audio_' + n[1]);
|
||||
obj.parentElement.insertBefore(player_div, obj);
|
||||
create_pleercom_ajax(n[1]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function create_pleercom_ajax(id){
|
||||
function create_pleercom_ajax(id) {
|
||||
$ajax({
|
||||
'url':'https://pleer.com/site_api/files/get_url',
|
||||
'type':'post',
|
||||
'postdata':'action=download&id='+id,
|
||||
'dont_set_content_type':true,
|
||||
'pleer_id':id,
|
||||
'headers':[['Accept','*'],['Content-Type','application/x-www-form-urlencoded; charset=UTF-8']],
|
||||
'url': 'https://pleer.com/site_api/files/get_url',
|
||||
'type': 'post',
|
||||
'postdata': 'action=download&id=' + id,
|
||||
'dont_set_content_type': true,
|
||||
'pleer_id': id,
|
||||
'headers': [['Accept', '*'], ['Content-Type', 'application/x-www-form-urlencoded; charset=UTF-8']],
|
||||
'success': function (a) {
|
||||
var answer = JSON.parse(a);
|
||||
var player = document.createElement('audio');
|
||||
|
@ -683,13 +725,63 @@ function create_pleercom_ajax(id){
|
|||
'controls': 'controls',
|
||||
'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');
|
||||
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,
|
||||
"name": "Point+",
|
||||
"version": "1.13.0",
|
||||
"version": "1.14.0",
|
||||
"default_locale": "ru",
|
||||
"author": "__MSG_ext_author__",
|
||||
"homepage_url": "https://bitbucket.org/skobkin/chrome_point_plus",
|
||||
|
|
|
@ -51,6 +51,10 @@
|
|||
|
||||
<div class="option">
|
||||
<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 class="option">
|
||||
|
@ -72,7 +76,11 @@
|
|||
|
||||
<div class="option">
|
||||
<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">
|
||||
<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>
|
||||
</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 class="tab-content" id="websocket">
|
||||
|
|
Loading…
Reference in a new issue