mirror of
https://bitbucket.org/skobkin/chrome_point_plus.git
synced 2024-11-23 18:56:04 +00:00
Merged skobkin/chrome_point_plus into master
This commit is contained in:
commit
79fad70964
|
@ -115,12 +115,12 @@ div#markItUpText-input {
|
||||||
padding: 5px 0 0 5px;
|
padding: 5px 0 0 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pp-options .option {
|
.pp-options .option-node {
|
||||||
display: block;
|
display: block;
|
||||||
margin: 5px 0 5px 15px;
|
margin: 5px 0 5px 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pp-options .option label {
|
.pp-options .option-node label {
|
||||||
font: 10pt Georgia;
|
font: 10pt Georgia;
|
||||||
color: #FFF;
|
color: #FFF;
|
||||||
}
|
}
|
||||||
|
@ -130,11 +130,11 @@ div#markItUpText-input {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Disables subcheckboxes if parent disabled */
|
/* Disables subcheckboxes if parent disabled */
|
||||||
.pp-options .option input[type="checkbox"]:not(:checked) ~.option {
|
.pp-options .option-node input[type="checkbox"]:not(:checked) ~.option-node {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pp-options .option input[type="checkbox"]:not(:checked) ~.option label {
|
.pp-options .option-node input[type="checkbox"]:not(:checked) ~.option-node label {
|
||||||
color: #BBB;
|
color: #BBB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,108 +1,30 @@
|
||||||
var ppOptions = [
|
var ppOptions = {};
|
||||||
// Fancybox
|
|
||||||
'option_fancybox',
|
|
||||||
// Open images in Fancybox
|
|
||||||
'option_fancybox_images',
|
|
||||||
// Open videos in Fancybox
|
|
||||||
'option_fancybox_videos',
|
|
||||||
// Open posts in Fancybox
|
|
||||||
'option_fancybox_posts',
|
|
||||||
// Bind all images from fancybox to one flow
|
|
||||||
'option_fancybox_bind_images_to_one_flow',
|
|
||||||
// Load original images
|
|
||||||
'option_images_load_original',
|
|
||||||
// Embedding
|
|
||||||
'option_embedding',
|
|
||||||
// Load images from Gelbooru, Danbooru, etc
|
|
||||||
'option_images_load_booru',
|
|
||||||
// Wrap WEBM videos into the <video> tag
|
|
||||||
'option_videos_parse_webm',
|
|
||||||
'option_videos_parse_all_videos',
|
|
||||||
// SoundCloud
|
|
||||||
'option_embedding_soundcloud',
|
|
||||||
'option_embedding_soundcloud_orig_link',
|
|
||||||
// Pleer.com
|
|
||||||
'option_embedding_pleercom',
|
|
||||||
'option_embedding_pleercom_nokita_server',
|
|
||||||
// NSFW filtering
|
|
||||||
'option_nsfw',
|
|
||||||
'option_nsfw_hide_posts',
|
|
||||||
// Blured pictures
|
|
||||||
'option_nsfw_blur_posts_images',
|
|
||||||
'option_nsfw_blur_posts_entire',
|
|
||||||
// Blur comments too
|
|
||||||
'option_nsfw_blur_comments_images',
|
|
||||||
'option_nsfw_blur_comments_entire',
|
|
||||||
// CTRL+Enter
|
|
||||||
'option_ctrl_enter',
|
|
||||||
// Fluid layout
|
|
||||||
'option_fluid_layout',
|
|
||||||
// Visual editor for posts
|
|
||||||
'option_visual_editor_post',
|
|
||||||
// Google search
|
|
||||||
'option_search_with_google',
|
|
||||||
// WebSocket
|
|
||||||
'option_ws',
|
|
||||||
// Comments
|
|
||||||
'option_ws_comments', 'option_ws_comments_color_fadeout', 'option_ws_comments_notifications',
|
|
||||||
// Feeds
|
|
||||||
'option_ws_feeds', 'option_ws_feeds_subscriptions', 'option_ws_feeds_blogs',
|
|
||||||
// Font size
|
|
||||||
'option_enlarge_font', 'option_enlarge_font_size',
|
|
||||||
// @ before username
|
|
||||||
'option_at_before_username',
|
|
||||||
// Highlight posts with new comments
|
|
||||||
'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.
|
// Saves options to localStorage.
|
||||||
function pp_save_options() {
|
function pp_save_options() {
|
||||||
ppOptions = {};
|
$('.option-node').find('input').each(function(idx, $input) {
|
||||||
ppOptions.option_ctrl_enter = $('#option-ctrl-enter').prop('checked');
|
console.log($(this));
|
||||||
ppOptions.option_fancybox = $('#option-fancybox').prop('checked');
|
|
||||||
ppOptions.option_fancybox_images = $('#option-fancybox-images').prop('checked');
|
|
||||||
ppOptions.option_fancybox_videos = $('#option-fancybox-videos').prop('checked');
|
|
||||||
ppOptions.option_fancybox_posts = $('#option-fancybox-posts').prop('checked');
|
|
||||||
ppOptions.option_fancybox_bind_images_to_one_flow = $('#option-fancybox-bind-images-to-one-flow').prop('checked');
|
|
||||||
ppOptions.option_fluid_layout = $('#option-fluid-layout').prop('checked');
|
|
||||||
ppOptions.option_images_load_original = $('#option-images-load-original').prop('checked');
|
|
||||||
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_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.checkbox_search_with_google = $('#option-search-with-google').prop('checked');
|
|
||||||
ppOptions.option_ws = $('#option-ws').prop('checked');
|
|
||||||
ppOptions.option_ws_comments = $('#option-ws-comments').prop('checked');
|
|
||||||
ppOptions.option_ws_comments_color_fadeout = $('#option-ws-comments-color-fadeout').prop('checked');
|
|
||||||
ppOptions.option_ws_comments_notifications = $('#option-ws-comments-notifications').prop('checked');
|
|
||||||
ppOptions.option_ws_feeds = $('#option-ws-feeds').prop('checked');
|
|
||||||
ppOptions.option_ws_feeds_subscriptions = $('#option-ws-feeds-subscriptions').prop('checked');
|
|
||||||
ppOptions.option_ws_feeds_blogs = $('#option-ws-feeds-blogs').prop('checked');
|
|
||||||
ppOptions.option_enlarge_font = $('#option-enlarge-font').prop('checked');
|
|
||||||
ppOptions.option_enlarge_font_size = document.querySelector('input[name="pp-font-size"]:checked').value;
|
|
||||||
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');
|
|
||||||
|
|
||||||
|
// Using option types
|
||||||
|
if ($(this).hasClass('option-boolean')) {
|
||||||
|
ppOptions[$(this).prop('id').replace(/-/g, '_')] = {
|
||||||
|
'type': 'boolean',
|
||||||
|
'value': $(this).prop('checked')
|
||||||
|
};
|
||||||
|
} else if ($(this).hasClass('option-enum')) {
|
||||||
|
if ($(this).prop('checked')) {
|
||||||
|
ppOptions[$(this).prop('name').replace(/-/g, '_')] = {
|
||||||
|
'type': 'enum',
|
||||||
|
'value': $(this).val()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log('Saving options: %O', ppOptions);
|
||||||
|
|
||||||
// Saving parameters
|
// Saving parameters
|
||||||
chrome.storage.sync.set(ppOptions, function() {
|
chrome.storage.sync.set({'options': ppOptions}, function() {
|
||||||
// Update status to let user know options were saved.
|
// Update status to let user know options were saved.
|
||||||
$('#status').html(chrome.i18n.getMessage('options_text_saved'));
|
$('#status').html(chrome.i18n.getMessage('options_text_saved'));
|
||||||
});
|
});
|
||||||
|
@ -110,23 +32,39 @@ function pp_save_options() {
|
||||||
|
|
||||||
// Restores select box state to saved value from localStorage.
|
// Restores select box state to saved value from localStorage.
|
||||||
function pp_restore_options() {
|
function pp_restore_options() {
|
||||||
// Loading options
|
// Cleaning old style options
|
||||||
chrome.storage.sync.get(ppOptions, function(options) {
|
// Delete after some time
|
||||||
// Setting options in DOM
|
chrome.storage.sync.get('option_fancybox', function(value) {
|
||||||
$.each(options, function(key, value) {
|
if (value === true || value === false) {
|
||||||
var optionId = null;
|
console.log('Found old-style options. Cleaning...');
|
||||||
|
chrome.storage.sync.get(null, function(old_options) {
|
||||||
// Detecting option type
|
console.log('Old data: %O', old_options);
|
||||||
if (typeof(value) == 'boolean') {
|
for (option in old_options) {
|
||||||
// Checkbox
|
chrome.storage.sync.remove(option);
|
||||||
if (value === true) {
|
|
||||||
optionId = '#' + key.replace(/_/g, '-');
|
|
||||||
$(optionId).first().prop('checked', true);
|
|
||||||
}
|
}
|
||||||
} else if (typeof(value) == 'number') {
|
console.log('All old data removed');
|
||||||
// Radio select
|
});
|
||||||
optionId = '#' + key.replace(/_/g, '-') + '-' + value;
|
}
|
||||||
$(optionId).first().prop('checked', true);
|
});
|
||||||
|
|
||||||
|
// Loading options
|
||||||
|
chrome.storage.sync.get('options', function(options) {
|
||||||
|
// Setting options in DOM
|
||||||
|
$.each(options.options, function(key, data) {
|
||||||
|
switch (data.type) {
|
||||||
|
case 'boolean':
|
||||||
|
if (data.value) {
|
||||||
|
$('#' + key.replace(/_/g, '-')).prop('checked', true);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'enum':
|
||||||
|
$('.option-node .option-enum[name="' + key.replace(/_/g, '-') + '"][value="' + data.value + '"]').prop('checked', true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
console.warn('Invalid option "%s" type: %O', key, data);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,38 +1,43 @@
|
||||||
$(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');
|
// @todo: Убрать это говно и нормально пилить расширение не принося пользователям костыли
|
||||||
if (point_plus_debug.length>0){
|
// Хочешь детект? Делай невидимый элемент где-нибудь в подвале. И айдишник, а не класс. Их искать быстрее.
|
||||||
|
// Хочешь показать пользователю обработку - делай индикатор и встраивай в интерфейс сайта.
|
||||||
|
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'));
|
console.info('Point+ already loaded, version: %s', point_plus_debug.attr('data-point-plus-version'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
point_plus_debug=null;
|
point_plus_debug = null;
|
||||||
var new_div=document.createElement('div');
|
var new_div = document.createElement('div');
|
||||||
document.body.appendChild(new_div);
|
document.body.appendChild(new_div);
|
||||||
$(new_div).attr({
|
$(new_div).attr({
|
||||||
'data-point-plus-version':getVersion()
|
'data-point-plus-version':getVersion()
|
||||||
}).addClass('point-plus-debug').html('Point+ v'+getVersion()+' loading...');
|
}).addClass('point-plus-debug').html('Point+ v' + getVersion() + ' loading...').hide();
|
||||||
new_div=null;
|
new_div = null;
|
||||||
|
|
||||||
// Loading options
|
// Loading options
|
||||||
chrome.storage.sync.get(ppOptions, function (options) {
|
chrome.storage.sync.get('options', function(options_data) {
|
||||||
|
var options = options_data.options;
|
||||||
|
|
||||||
// Options debug
|
// Options debug
|
||||||
console.debug('Options loaded: %O', options);
|
console.debug('Options loaded: %O', options);
|
||||||
|
|
||||||
create_tag_system();
|
create_tag_system();
|
||||||
|
|
||||||
// Embedding
|
// Embedding
|
||||||
if (options.option_embedding == true) {
|
if (options.option_embedding.value == true) {
|
||||||
// Load pictures from Booru, Tumblr and some other sites
|
// Load pictures from Booru, Tumblr and some other sites
|
||||||
if (options.option_images_load_booru == true) {
|
if (options.option_images_load_booru.value == true) {
|
||||||
load_all_booru_images();
|
load_all_booru_images();
|
||||||
}
|
}
|
||||||
// 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.value == true) {
|
||||||
if (options.option_videos_parse_all_videos == true) {
|
if (options.option_videos_parse_all_videos.value == true) {
|
||||||
parse_all_videos();
|
parse_all_videos();
|
||||||
} else {
|
} else {
|
||||||
parse_webm();
|
parse_webm();
|
||||||
|
@ -40,7 +45,7 @@ $(document).ready(function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Soundcloud
|
// Soundcloud
|
||||||
if (options.option_embedding_soundcloud == true) {
|
if (options.option_embedding_soundcloud.value == true) {
|
||||||
// Injecting JS API
|
// Injecting JS API
|
||||||
chrome.extension.sendMessage({
|
chrome.extension.sendMessage({
|
||||||
type: 'injectJSFile',
|
type: 'injectJSFile',
|
||||||
|
@ -48,22 +53,22 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Processing links
|
// Processing links
|
||||||
$('.post .post-content a[href*="\\:\\/\\/soundcloud\\.com\\/"]').each(function (index) {
|
$('.post .post-content a[href*="\\:\\/\\/soundcloud\\.com\\/"]').each(function(index) {
|
||||||
console.log($(this));
|
console.log($(this));
|
||||||
|
|
||||||
$player = $('<div class="pp-soundcloud">\
|
$player = $('<div class="pp-soundcloud">\
|
||||||
<object height="81" width="100%" id="pp-soundcloud-' + index + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">\
|
<object height="81" width="100%" id="pp-soundcloud-' + index + '" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">\
|
||||||
<param name="movie" value="//player.soundcloud.com/player.swf?url=' + encodeURIComponent($(this).prop('href'))
|
<param name="movie" value="//player.soundcloud.com/player.swf?url=' + encodeURIComponent($(this).prop('href'))
|
||||||
+ '&enable_api=true&object_id=pp-soundcloud-' + index + '">\
|
+ '&enable_api=true&object_id=pp-soundcloud-' + index + '">\
|
||||||
<param name="allowscriptaccess" value="always">\
|
<param name="allowscriptaccess" value="always">\
|
||||||
<embed allowscriptaccess="always" height="81" src="//player.soundcloud.com/player.swf?url='
|
<embed allowscriptaccess="always" height="81" src="//player.soundcloud.com/player.swf?url='
|
||||||
+ encodeURIComponent($(this).prop('href')) + '&enable_api=true&object_id=pp-soundcloud-' + index
|
+ encodeURIComponent($(this).prop('href')) + '&enable_api=true&object_id=pp-soundcloud-' + index
|
||||||
+ '" type="application/x-shockwave-flash" width="100%" name="pp-soundcloud-' + index + '"></embed>\
|
+ '" type="application/x-shockwave-flash" width="100%" name="pp-soundcloud-' + index + '"></embed>\
|
||||||
</object>\
|
</object>\
|
||||||
</div>');
|
</div>');
|
||||||
|
|
||||||
// Replace or prepend
|
// Replace or prepend
|
||||||
if (options.option_embedding_soundcloud_orig_link == true) {
|
if (options.option_embedding_soundcloud_orig_link.value == true) {
|
||||||
// Before
|
// Before
|
||||||
$(this).before($player);
|
$(this).before($player);
|
||||||
} else {
|
} else {
|
||||||
|
@ -74,25 +79,25 @@ $(document).ready(function () {
|
||||||
|
|
||||||
}
|
}
|
||||||
// Parse webm-links and create video instead
|
// Parse webm-links and create video instead
|
||||||
if (options.option_embedding_pleercom == true) {
|
if (options.option_embedding_pleercom.value == true) {
|
||||||
parse_pleercom_links();
|
parse_pleercom_links();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fancybox
|
// Fancybox
|
||||||
if (options.option_fancybox == true) {
|
if (options.option_fancybox.value == true) {
|
||||||
if (options.option_fancybox_bind_images_to_one_flow == true) {
|
if (options.option_fancybox_bind_images_to_one_flow.value == 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('data-fancybox-group', 'one_flow_gallery');
|
$(this).find('a.postimg:not(.youtube)').attr('data-fancybox-group', 'one_flow_gallery');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Images
|
// Images
|
||||||
if (options.option_fancybox_images == true) {
|
if (options.option_fancybox_images.value == true) {
|
||||||
if (options.option_fancybox_bind_images_to_one_flow !== true) {
|
if (options.option_fancybox_bind_images_to_one_flow.value !== 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('data-fancybox-group', 'post' + idxPost);
|
$(this).find('a.postimg:not(.youtube)').attr('data-fancybox-group', 'post' + idxPost);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -102,7 +107,7 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Правим хинт в FancyBox
|
// Правим хинт в FancyBox
|
||||||
$('.post').each(function () {
|
$('.post').each(function() {
|
||||||
var all_post_images = $(this).find('.postimg');
|
var all_post_images = $(this).find('.postimg');
|
||||||
if (all_post_images.length == 0) {
|
if (all_post_images.length == 0) {
|
||||||
return;
|
return;
|
||||||
|
@ -146,7 +151,7 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Videos
|
// Videos
|
||||||
if (options.option_fancybox_videos == true) {
|
if (options.option_fancybox_videos.value == true) {
|
||||||
$('.postimg.youtube').addClass('fancybox-media').fancybox({
|
$('.postimg.youtube').addClass('fancybox-media').fancybox({
|
||||||
helpers: {
|
helpers: {
|
||||||
media: {
|
media: {
|
||||||
|
@ -160,7 +165,7 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Posts
|
// Posts
|
||||||
if (options.option_fancybox_posts == true) {
|
if (options.option_fancybox_posts.value == true) {
|
||||||
// Excluding some sort of piece-of-shit makeup
|
// Excluding some sort of piece-of-shit makeup
|
||||||
$('.post-id a').not('#comments .post-id a, #top-post .post-id a').attr('data-fancybox-type', 'iframe').fancybox({
|
$('.post-id a').not('#comments .post-id a, #top-post .post-id a').attr('data-fancybox-type', 'iframe').fancybox({
|
||||||
maxWidth: 780
|
maxWidth: 780
|
||||||
|
@ -169,20 +174,20 @@ $(document).ready(function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
// NSFW Filtering
|
// NSFW Filtering
|
||||||
if (options.option_nsfw == true) {
|
if (options.option_nsfw.value == true) {
|
||||||
$('.post-tag-nsfw,.post-tag-сиськи').find('a.postimg:not(.youtube)').attr('data-fancybox-group', 'hidden-images');
|
$('.post-tag-nsfw,.post-tag-сиськи').find('a.postimg:not(.youtube)').attr('data-fancybox-group', 'hidden-images');
|
||||||
|
|
||||||
if (options.option_nsfw_hide_posts == true) {
|
if (options.option_nsfw_hide_posts.value == true) {
|
||||||
if ($('#comments').length == 0) {
|
if ($('#comments').length == 0) {
|
||||||
console.log('Hide NSFW posts in feed');
|
console.log('Hide NSFW posts in feed');
|
||||||
$('.post').addClass('hide-nsfw-posts');
|
$('.post').addClass('hide-nsfw-posts');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Blurred posts
|
// Blurred posts
|
||||||
if (options.option_nsfw_blur_posts_entire == true) {
|
if (options.option_nsfw_blur_posts_entire.value == true) {
|
||||||
console.log('Bluring NSFW posts');
|
console.log('Bluring NSFW posts');
|
||||||
$('.post').addClass('blur-nsfw-entire');
|
$('.post').addClass('blur-nsfw-entire');
|
||||||
} else if (options.option_nsfw_blur_posts_images == true) {
|
} else if (options.option_nsfw_blur_posts_images.value == true) {
|
||||||
console.log('Bluring images in NSFW posts');
|
console.log('Bluring images in NSFW posts');
|
||||||
$('.post').addClass('blur-nsfw-images');
|
$('.post').addClass('blur-nsfw-images');
|
||||||
}
|
}
|
||||||
|
@ -190,10 +195,10 @@ $(document).ready(function () {
|
||||||
|
|
||||||
// Blurred comments
|
// Blurred comments
|
||||||
if ($('.post').hasClass('post-tag-nsfw') || $('.post').hasClass('post-tag-сиськи')) {
|
if ($('.post').hasClass('post-tag-nsfw') || $('.post').hasClass('post-tag-сиськи')) {
|
||||||
if (options.option_nsfw_blur_comments_entire == true) {
|
if (options.option_nsfw_blur_comments_entire.value == true) {
|
||||||
console.log('Bluring comments');
|
console.log('Bluring comments');
|
||||||
$('#comments').addClass('blur-nsfw-entire');
|
$('#comments').addClass('blur-nsfw-entire');
|
||||||
} else if (options.option_nsfw_blur_comments_images == true) {
|
} else if (options.option_nsfw_blur_comments_images.value == true) {
|
||||||
// @hint Никита Ветров официально складывает с себя все претензии, если у кого-то от этого говна упадёт драйвер видео-карты
|
// @hint Никита Ветров официально складывает с себя все претензии, если у кого-то от этого говна упадёт драйвер видео-карты
|
||||||
console.log('Bluring images in comments');
|
console.log('Bluring images in comments');
|
||||||
$('#comments').addClass('blur-nsfw-images');
|
$('#comments').addClass('blur-nsfw-images');
|
||||||
|
@ -203,17 +208,17 @@ $(document).ready(function () {
|
||||||
|
|
||||||
// Hotkeys
|
// Hotkeys
|
||||||
// Send by CTRL+Enter
|
// Send by CTRL+Enter
|
||||||
if (options.option_ctrl_enter == true) {
|
if (options.option_ctrl_enter.value == 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();
|
||||||
|
@ -222,7 +227,7 @@ $(document).ready(function () {
|
||||||
}
|
}
|
||||||
// Look and feel
|
// Look and feel
|
||||||
// Fluid #main layout
|
// Fluid #main layout
|
||||||
if (options.option_fluid_layout == true) {
|
if (options.option_fluid_layout.value == true) {
|
||||||
$('#main, #header, #subheader, #footer').css({
|
$('#main, #header, #subheader, #footer').css({
|
||||||
'width': '95%',
|
'width': '95%',
|
||||||
'max-width': '95%'
|
'max-width': '95%'
|
||||||
|
@ -230,9 +235,9 @@ $(document).ready(function () {
|
||||||
// TODO: fix #main #left-menu #top-link position
|
// TODO: fix #main #left-menu #top-link position
|
||||||
}
|
}
|
||||||
// Image resizing
|
// Image resizing
|
||||||
if (options.option_images_load_original == true) {
|
if (options.option_images_load_original.value == 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'));
|
||||||
});
|
});
|
||||||
|
@ -245,16 +250,16 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// Visual editor
|
// Visual editor
|
||||||
if (options.option_visual_editor_post == true) {
|
if (options.option_visual_editor_post.value == true) {
|
||||||
// Add classes
|
// Add classes
|
||||||
$('#new-post-form #text-input, .post-content #text-input').addClass('markitup').css('height', '20em');
|
$('#new-post-form #text-input, .post-content #text-input').addClass('markitup').css('height', '20em');
|
||||||
// Init
|
// Init
|
||||||
$('.markitup').markItUp(mySettings);
|
$('.markitup').markItUp(mySettings);
|
||||||
|
|
||||||
// Send by CTRL+Enter
|
// Send by CTRL+Enter
|
||||||
if (options.option_ctrl_enter == true) {
|
if (options.option_ctrl_enter.value == 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();
|
||||||
|
@ -263,8 +268,8 @@ $(document).ready(function () {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Google search
|
// Google search
|
||||||
if (options.option_search_with_google == true) {
|
if (options.option_search_with_google.value == 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();
|
||||||
|
@ -272,7 +277,7 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
// WebSocket
|
// WebSocket
|
||||||
if (options.option_ws == true) {
|
if (options.option_ws.value == true) {
|
||||||
// SSL or plain
|
// SSL or plain
|
||||||
ws = new WebSocket(((location.protocol == 'https:') ? 'wss' : 'ws') + '://point.im/ws');
|
ws = new WebSocket(((location.protocol == 'https:') ? 'wss' : 'ws') + '://point.im/ws');
|
||||||
console.log('WebSocket created: %O', ws);
|
console.log('WebSocket created: %O', ws);
|
||||||
|
@ -285,12 +290,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') {
|
||||||
|
@ -306,7 +311,7 @@ $(document).ready(function () {
|
||||||
console.debug(wsMessage);
|
console.debug(wsMessage);
|
||||||
|
|
||||||
// Check option
|
// Check option
|
||||||
if (options.option_ws_comments != true) {
|
if (options.option_ws_comments.value != true) {
|
||||||
console.log('Comments processing disabled');
|
console.log('Comments processing disabled');
|
||||||
console.groupEnd();
|
console.groupEnd();
|
||||||
break;
|
break;
|
||||||
|
@ -337,7 +342,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');
|
||||||
|
|
||||||
|
@ -418,13 +423,13 @@ $(document).ready(function () {
|
||||||
$commentTemplate.before($anchor);
|
$commentTemplate.before($anchor);
|
||||||
|
|
||||||
// Fading out highlight if needed
|
// Fading out highlight if needed
|
||||||
if (options.option_ws_comments_color_fadeout == true) {
|
if (options.option_ws_comments_color_fadeout.value == true) {
|
||||||
console.log('Fading out the highlight');
|
console.log('Fading out the highlight');
|
||||||
$commentTemplate.children('.pp-highlight').fadeOut(20000);
|
$commentTemplate.children('.pp-highlight').fadeOut(20000);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Desktop notifications
|
// Desktop notifications
|
||||||
if (options.option_ws_comments_notifications == true) {
|
if (options.option_ws_comments_notifications.value == true) {
|
||||||
console.log('Showing desktop notification');
|
console.log('Showing desktop notification');
|
||||||
chrome.extension.sendMessage({
|
chrome.extension.sendMessage({
|
||||||
type: 'showNotification',
|
type: 'showNotification',
|
||||||
|
@ -480,11 +485,11 @@ $(document).ready(function () {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
// Font size
|
// Font size
|
||||||
if ((options.option_enlarge_font == true) && (options.option_enlarge_font_size !== undefined)) {
|
if ((options.option_enlarge_font.value == true) && (options.option_enlarge_font_size.value !== undefined)) {
|
||||||
$('body').css('font-size', (options.option_enlarge_font_size / 100) + 'em');
|
$('body').css('font-size', (options.option_enlarge_font_size.value / 100) + 'em');
|
||||||
}
|
}
|
||||||
// @ before username
|
// @ before username
|
||||||
if (options.option_at_before_username == true) {
|
if (options.option_at_before_username.value == true) {
|
||||||
chrome.extension.sendMessage({
|
chrome.extension.sendMessage({
|
||||||
type: 'injectCSSFile',
|
type: 'injectCSSFile',
|
||||||
file: 'css/modules/at_before_username.css'
|
file: 'css/modules/at_before_username.css'
|
||||||
|
@ -492,15 +497,15 @@ $(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.value == 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.value == true) {
|
||||||
set_posts_count_label();
|
set_posts_count_label();
|
||||||
}
|
}
|
||||||
// `Space` key scroll handler
|
// `Space` key scroll handler
|
||||||
if (options.option_other_scroll_space_key == true){
|
if (options.option_other_scroll_space_key.value == true){
|
||||||
set_space_key_skip_handler();
|
set_space_key_skip_handler();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,7 +513,9 @@ $(document).ready(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Showing page action
|
// Showing page action
|
||||||
chrome.extension.sendMessage({type: 'showPageAction'});
|
chrome.extension.sendMessage({
|
||||||
|
type: 'showPageAction'
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function escapeHtml(text) {
|
function escapeHtml(text) {
|
||||||
|
@ -531,7 +538,7 @@ var months = [
|
||||||
// Картинки с бурятников
|
// Картинки с бурятников
|
||||||
var booru_picture_count = 0;
|
var booru_picture_count = 0;
|
||||||
function load_all_booru_images() {
|
function load_all_booru_images() {
|
||||||
$('a').each(function (num, obj) {
|
$('a').each(function(num, obj) {
|
||||||
if ($(obj).hasClass('booru_pic')) {
|
if ($(obj).hasClass('booru_pic')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -568,11 +575,11 @@ function load_all_booru_images() {
|
||||||
obj.parentElement.insertBefore(image, obj);
|
obj.parentElement.insertBefore(image, obj);
|
||||||
booru_picture_count++;
|
booru_picture_count++;
|
||||||
/*
|
/*
|
||||||
}else if (n=href.match(new RegExp('^https?\\://(www\\.)?konachan\\.net\\/post\\/show\\/([0-9]+)\\/', 'i'))){
|
} else if (n = href.match(new RegExp('^https?\\://(www\\.)?konachan\\.net\\/post\\/show\\/([0-9]+)\\/', 'i'))) {
|
||||||
var image=create_image('konachannet', n[2]);
|
var image = create_image('konachannet', n[2]);
|
||||||
obj.parentElement.insertBefore(image, obj);
|
obj.parentElement.insertBefore(image, obj);
|
||||||
booru_picture_count++;
|
booru_picture_count++;
|
||||||
}else if (n=href.match(new RegExp('^https?\\://(www\\.)?konachan\\.com\\/post\\/show\\/([0-9]+)\\/', 'i'))){
|
} else if (n = href.match(new RegExp('^https?\\://(www\\.)?konachan\\.com\\/post\\/show\\/([0-9]+)\\/', 'i'))) {
|
||||||
var image=create_image('konachancom', n[2]);
|
var image=create_image('konachancom', n[2]);
|
||||||
obj.parentElement.insertBefore(image, obj);
|
obj.parentElement.insertBefore(image, obj);
|
||||||
booru_picture_count++;
|
booru_picture_count++;
|
||||||
|
@ -634,7 +641,7 @@ function mark_unread_post() {
|
||||||
|
|
||||||
// Webm
|
// Webm
|
||||||
function parse_webm() {
|
function parse_webm() {
|
||||||
$('a').each(function (num, obj) {
|
$('a').each(function(num, obj) {
|
||||||
if ($(obj).hasClass('booru_pic')) {
|
if ($(obj).hasClass('booru_pic')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -656,7 +663,7 @@ function parse_webm() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function parse_all_videos() {
|
function parse_all_videos() {
|
||||||
$('a').each(function (num, obj) {
|
$('a').each(function(num, obj) {
|
||||||
if ($(obj).hasClass('booru_pic')) {
|
if ($(obj).hasClass('booru_pic')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -678,7 +685,7 @@ function parse_all_videos() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function video_extension_to_mime(extension) {
|
function video_extension_to_mime(extension) {
|
||||||
switch(extension){
|
switch (extension) {
|
||||||
case 'webm':return 'video/webm; codecs="vp8, vorbis';
|
case 'webm':return 'video/webm; codecs="vp8, vorbis';
|
||||||
case 'avi' :return 'video/avi;';
|
case 'avi' :return 'video/avi;';
|
||||||
case 'mp4' :return 'video/mp4;';
|
case 'mp4' :return 'video/mp4;';
|
||||||
|
@ -693,7 +700,7 @@ function set_posts_count_label() {
|
||||||
var ids = [];
|
var ids = [];
|
||||||
$('.post .post-id a .cn').addClass('changed_background');
|
$('.post .post-id a .cn').addClass('changed_background');
|
||||||
|
|
||||||
$('div.post').each(function (num, obj) {
|
$('div.post').each(function(num, obj) {
|
||||||
var t = $(obj).attr('data-comment-id');
|
var t = $(obj).attr('data-comment-id');
|
||||||
if (typeof(t) !== 'undefined') {
|
if (typeof(t) !== 'undefined') {
|
||||||
return;
|
return;
|
||||||
|
@ -704,10 +711,10 @@ function set_posts_count_label() {
|
||||||
|
|
||||||
$ajax({
|
$ajax({
|
||||||
'url': 'https://api.kanaria.ru/point/get_post_info.php?list=' + urlencode(ids.join(',')),
|
'url': 'https://api.kanaria.ru/point/get_post_info.php?list=' + urlencode(ids.join(',')),
|
||||||
'success': function (a) {
|
'success': function(a) {
|
||||||
var answer = JSON.parse(a);
|
var answer = JSON.parse(a);
|
||||||
|
|
||||||
$('div.post').each(function (num, obj) {
|
$('div.post').each(function(num, obj) {
|
||||||
var id = $(obj).attr('data-id');
|
var id = $(obj).attr('data-id');
|
||||||
var postid = $(obj).find('.post-id a')[0];
|
var postid = $(obj).find('.post-id a')[0];
|
||||||
var t = $(obj).attr('data-comment-id');
|
var t = $(obj).attr('data-comment-id');
|
||||||
|
@ -733,7 +740,7 @@ 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 {
|
||||||
|
@ -743,7 +750,7 @@ function parse_pleercom_links() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function parse_pleercom_links_nokita() {
|
function parse_pleercom_links_nokita() {
|
||||||
$('a').each(function (num, obj) {
|
$('a').each(function(num, obj) {
|
||||||
var href = obj.href;
|
var href = obj.href;
|
||||||
var n = null;
|
var n = null;
|
||||||
|
|
||||||
|
@ -765,7 +772,7 @@ 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;
|
||||||
|
|
||||||
|
@ -786,7 +793,7 @@ function create_pleercom_ajax(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');
|
||||||
// @todo Проверять существование track_link
|
// @todo Проверять существование track_link
|
||||||
|
@ -797,7 +804,7 @@ function create_pleercom_ajax(id) {
|
||||||
});
|
});
|
||||||
$('.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);
|
||||||
}
|
}
|
||||||
|
@ -808,40 +815,7 @@ function create_pleercom_ajax(id) {
|
||||||
|
|
||||||
// Проставляем теги у постов
|
// Проставляем теги у постов
|
||||||
function create_tag_system() {
|
function create_tag_system() {
|
||||||
$('.post').each(function () {
|
$('.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 create_tag_system() {
|
|
||||||
$('.post').each(function () {
|
|
||||||
var tags = $(this).find('div.tags a.tag');
|
var tags = $(this).find('div.tags a.tag');
|
||||||
for (var i = 0; i < tags.length; i++) {
|
for (var i = 0; i < tags.length; i++) {
|
||||||
var tag_name = $(tags[i]).html().toLowerCase();
|
var tag_name = $(tags[i]).html().toLowerCase();
|
||||||
|
@ -857,7 +831,40 @@ function set_space_key_skip_handler() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo Свериться с Best-practice биндинга функций. Мб там on или bind
|
// @todo Свериться с Best-practice биндинга функций. Мб там on или bind
|
||||||
$(document.body).keydown(function (e) {
|
$(document.body).keydown(function(e) {
|
||||||
|
// @todo Я хотел по отпусканию кнопки, но там уже скролл срабатывает
|
||||||
|
// проверяем фокус
|
||||||
|
if ($(':focus').length > 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var k = event.keyCode;
|
||||||
|
if (k == 32){
|
||||||
|
space_key_event();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Проставляем теги у постов
|
||||||
|
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 Я хотел по отпусканию кнопки, но там уже скролл срабатывает
|
// @todo Я хотел по отпусканию кнопки, но там уже скролл срабатывает
|
||||||
// проверяем фокус
|
// проверяем фокус
|
||||||
if ($(':focus').length > 0) {
|
if ($(':focus').length > 0) {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{
|
{
|
||||||
"manifest_version": 2,
|
"manifest_version": 2,
|
||||||
"name": "Point+",
|
"name": "Point+",
|
||||||
"version": "1.14.2",
|
"version": "1.15.1",
|
||||||
"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",
|
||||||
|
|
|
@ -18,156 +18,156 @@
|
||||||
|
|
||||||
<div id="tabs-content">
|
<div id="tabs-content">
|
||||||
<div class="tab-content" id="media">
|
<div class="tab-content" id="media">
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-fancybox"><label for="option-fancybox" data-i18n="option_fancybox"></label>
|
<input type="checkbox" class="option-boolean" id="option-fancybox"><label for="option-fancybox" data-i18n="option_fancybox"></label>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-fancybox-images"><label for="option-fancybox-images" data-i18n="option_fancybox_images"></label>
|
<input type="checkbox" class="option-boolean" id="option-fancybox-images"><label for="option-fancybox-images" data-i18n="option_fancybox_images"></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-fancybox-videos"><label for="option-fancybox-videos" data-i18n="option_fancybox_videos"></label>
|
<input type="checkbox" class="option-boolean" id="option-fancybox-videos"><label for="option-fancybox-videos" data-i18n="option_fancybox_videos"></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-fancybox-posts"><label for="option-fancybox-posts" data-i18n="option_fancybox_posts"></label>
|
<input type="checkbox" class="option-boolean" id="option-fancybox-posts"><label for="option-fancybox-posts" data-i18n="option_fancybox_posts"></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-fancybox-bind-images-to-one-flow"><label for="option-fancybox-bind-images-to-one-flow" data-i18n="option_fancybox_bind_images_to_one_flow"></label>
|
<input type="checkbox" class="option-boolean" id="option-fancybox-bind-images-to-one-flow"><label for="option-fancybox-bind-images-to-one-flow" data-i18n="option_fancybox_bind_images_to_one_flow"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-images-load-original"><label for="option-images-load-original" data-i18n="option_images_load_original"></label>
|
<input type="checkbox" class="option-boolean" id="option-images-load-original"><label for="option-images-load-original" data-i18n="option_images_load_original"></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-embedding"><label for="option-embedding" data-i18n="option_embedding"></label>
|
<input type="checkbox" class="option-boolean" id="option-embedding"><label for="option-embedding" data-i18n="option_embedding"></label>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-images-load-booru"><label for="option-images-load-booru" data-i18n="option_images_load_booru"></label>
|
<input type="checkbox" class="option-boolean" id="option-images-load-booru"><label for="option-images-load-booru" data-i18n="option_images_load_booru"></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-videos-parse-webm"><label for="option-videos-parse-webm" data-i18n="option_videos_parse_webm"></label>
|
<input type="checkbox" class="option-boolean" id="option-videos-parse-webm"><label for="option-videos-parse-webm" data-i18n="option_videos_parse_webm"></label>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-videos-parse-all-videos"><label for="option-videos-parse-all-videos" data-i18n="option_videos_parse_all_videos"></label>
|
<input type="checkbox" class="option-boolean" 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>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-embedding-soundcloud"><label for="option-embedding-soundcloud" data-i18n="option_embedding_soundcloud"></label>
|
<input type="checkbox" class="option-boolean" id="option-embedding-soundcloud"><label for="option-embedding-soundcloud" data-i18n="option_embedding_soundcloud"></label>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-embedding-soundcloud-orig-link"><label for="option-embedding-soundcloud-orig-link" data-i18n="option_embedding_soundcloud_orig_link"></label>
|
<input type="checkbox" class="option-boolean" id="option-embedding-soundcloud-orig-link"><label for="option-embedding-soundcloud-orig-link" data-i18n="option_embedding_soundcloud_orig_link"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-embedding-pleercom"><label for="option-embedding-pleercom" data-i18n="option_embedding_pleercom"></label>
|
<input type="checkbox" class="option-boolean" id="option-embedding-pleercom"><label for="option-embedding-pleercom" data-i18n="option_embedding_pleercom"></label>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-embedding-pleercom-nokita-server"><label for="option-embedding-pleercom-nokita-server" data-i18n="option_embedding_pleercom_nokita_server"></label>
|
<input type="checkbox" class="option-boolean" id="option-embedding-pleercom-nokita-server"><label for="option-embedding-pleercom-nokita-server" data-i18n="option_embedding_pleercom_nokita_server"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-nsfw"><label for="option-nsfw" data-i18n="option_nsfw"></label>
|
<input type="checkbox" class="option-boolean" id="option-nsfw"><label for="option-nsfw" data-i18n="option_nsfw"></label>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-nsfw-hide-posts"><label for="option-nsfw-hide-posts" data-i18n="option_nsfw_hide_posts"></label>
|
<input type="checkbox" class="option-boolean" id="option-nsfw-hide-posts"><label for="option-nsfw-hide-posts" data-i18n="option_nsfw_hide_posts"></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-nsfw-blur-posts-images"><label for="option-nsfw-blur-posts-images" data-i18n="option_nsfw_blur_posts_images"></label>
|
<input type="checkbox" class="option-boolean" id="option-nsfw-blur-posts-images"><label for="option-nsfw-blur-posts-images" data-i18n="option_nsfw_blur_posts_images"></label>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-nsfw-blur-posts-entire"><label for="option-nsfw-blur-posts-entire" data-i18n="option_nsfw_blur_posts_entire"></label>
|
<input type="checkbox" class="option-boolean" id="option-nsfw-blur-posts-entire"><label for="option-nsfw-blur-posts-entire" data-i18n="option_nsfw_blur_posts_entire"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-nsfw-blur-comments-images"><label for="option-nsfw-blur-comments-images" data-i18n="option_nsfw_blur_comments_images"></label>
|
<input type="checkbox" class="option-boolean" id="option-nsfw-blur-comments-images"><label for="option-nsfw-blur-comments-images" data-i18n="option_nsfw_blur_comments_images"></label>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-nsfw-blur-comments-entire"><label for="option-nsfw-blur-comments-entire" data-i18n="option_nsfw_blur_comments_entire"></label>
|
<input type="checkbox" class="option-boolean" 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>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="tab-content" id="other">
|
<div class="tab-content" id="other">
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-ctrl-enter" disabled="disabled"><label for="option-ctrl-enter" data-i18n="option_ctrl_enter"></label>
|
<input type="checkbox" class="option-boolean" id="option-ctrl-enter" disabled="disabled"><label for="option-ctrl-enter" data-i18n="option_ctrl_enter"></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-fluid-layout"><label for="option-fluid-layout" data-i18n="option_fluid_layout"></label>
|
<input type="checkbox" class="option-boolean" id="option-fluid-layout"><label for="option-fluid-layout" data-i18n="option_fluid_layout"></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-visual-editor-post"><label for="option-visual-editor-post" data-i18n="option_visual_editor_post"></label>
|
<input type="checkbox" class="option-boolean" id="option-visual-editor-post"><label for="option-visual-editor-post" data-i18n="option_visual_editor_post"></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-search-with-google"><label for="option-search-with-google" data-i18n="option_search_with_google"></label>
|
<input type="checkbox" class="option-boolean" id="option-search-with-google"><label for="option-search-with-google" data-i18n="option_search_with_google"></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-enlarge-font"><label for="option-enlarge-font" data-i18n="option_enlarge_font"></label>
|
<input type="checkbox" class="option-boolean" id="option-enlarge-font"><label for="option-enlarge-font" data-i18n="option_enlarge_font"></label>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input name="pp-font-size" id="option-enlarge-font-85" type="radio" value="85" checked="checked"><label for="option-enlarge-font-85">0.85em</label>
|
<input type="radio" class="option-enum" name="option-enlarge-font-size" id="option-enlarge-font-size-85" value="85" checked="checked"><label for="option-enlarge-font-size-85">0.85em</label>
|
||||||
<input name="pp-font-size" id="option-enlarge-font-100" type="radio" value="100"><label for="option-enlarge-font-100">1em</label>
|
<input type="radio" class="option-enum" name="option-enlarge-font-size" id="option-enlarge-font-size-100" value="100"><label for="option-enlarge-font-size-100">1em</label>
|
||||||
<input name="pp-font-size" id="option-enlarge-font-110" type="radio" value="110"><label for="option-enlarge-font-110">1.1em</label>
|
<input type="radio" class="option-enum" name="option-enlarge-font-size" id="option-enlarge-font-size-110" value="110"><label for="option-enlarge-font-size-110">1.1em</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-at-before-username"><label for="option-at-before-username" data-i18n="option_at_before_username"></label>
|
<input type="checkbox" class="option-boolean" id="option-at-before-username"><label for="option-at-before-username" data-i18n="option_at_before_username"></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-other-hightlight-post-comments"><label for="option-other-hightlight-post-comments" data-i18n="option_other_hightlight_post_comments"></label>
|
<input type="checkbox" class="option-boolean" id="option-other-hightlight-post-comments"><label for="option-other-hightlight-post-comments" data-i18n="option_other_hightlight_post_comments"></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<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" class="option-boolean" 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">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-other-scroll-space-key"><label for="option-other-scroll-space-key" data-i18n="option_other_scroll_space_key"></label>
|
<input type="checkbox" class="option-boolean" 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>
|
||||||
|
|
||||||
<div class="tab-content" id="websocket">
|
<div class="tab-content" id="websocket">
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-ws"><label for="option-ws" data-i18n="option_ws"></label>
|
<input type="checkbox" class="option-boolean" id="option-ws"><label for="option-ws" data-i18n="option_ws"></label>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-ws-comments"><label for="option-ws-comments" data-i18n="option_ws_comments"></label>
|
<input type="checkbox" class="option-boolean" id="option-ws-comments"><label for="option-ws-comments" data-i18n="option_ws_comments"></label>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-ws-comments-color-fadeout"><label for="option-ws-comments-color-fadeout" data-i18n="option_ws_comments_color_fadeout"></label>
|
<input type="checkbox" class="option-boolean" id="option-ws-comments-color-fadeout"><label for="option-ws-comments-color-fadeout" data-i18n="option_ws_comments_color_fadeout"></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-ws-comments-notifications"><label for="option-ws-comments-notifications" data-i18n="option_ws_comments_notifications"></label>
|
<input type="checkbox" class="option-boolean" id="option-ws-comments-notifications"><label for="option-ws-comments-notifications" data-i18n="option_ws_comments_notifications"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-ws-feeds" disabled><label for="option-ws-feeds" data-i18n="option_ws_feeds"></label>
|
<input type="checkbox" class="option-boolean" id="option-ws-feeds" disabled><label for="option-ws-feeds" data-i18n="option_ws_feeds"></label>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-ws-feeds-subscriptions"><label for="option-ws-feeds-subscriptions" data-i18n="option_ws_feeds_subscriptions"></label>
|
<input type="checkbox" class="option-boolean" id="option-ws-feeds-subscriptions"><label for="option-ws-feeds-subscriptions" data-i18n="option_ws_feeds_subscriptions"></label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="option">
|
<div class="option-node">
|
||||||
<input type="checkbox" id="option-ws-feeds-blogs"><label for="option-ws-feeds-blogs" data-i18n="option_ws_feeds_blogs"></label>
|
<input type="checkbox" class="option-boolean" id="option-ws-feeds-blogs"><label for="option-ws-feeds-blogs" data-i18n="option_ws_feeds_blogs"></label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue