+ Обновление кол-ва комментариев/сообщений в заголовке

This commit is contained in:
Nokita Kaze 2015-01-02 22:10:02 +03:00
parent 8287bf4da1
commit d166ece3dd
5 changed files with 25 additions and 5 deletions

View File

@ -165,6 +165,9 @@
"option_other_comments_count_refresh":{
"message": "Refresh unread posts and comments count in left menu"
},
"option_other_comments_count_refresh_title":{
"message": "Show counts in the title of tabs"
},
"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>"

View File

@ -165,6 +165,9 @@
"option_other_comments_count_refresh":{
"message": "Обновляем количество непрочитанных комментариев и постов в ленте"
},
"option_other_comments_count_refresh_title":{
"message": "Указываем кол-во комментариев и сообщений в заголовке страницы"
},
"options_feedback_text": {

View File

@ -509,7 +509,7 @@ $(document).ready(function() {
// Обновляем кол-во постов и непрочитанных комментариев
if (options.option_other_comments_count_refresh.value == true){
set_comments_refresh_tick();
set_comments_refresh_tick(options);
}
$('#point-plus-debug').fadeOut(1000);
@ -1218,7 +1218,7 @@ function draw_nesting_level_indicator_level(obj, level) {
/**
* Обновляем кол-во комментариев и непрочитанных новых постов в ленте
*/
function set_comments_refresh_tick() {
function set_comments_refresh_tick(current_options) {
// Проверяем, чтобы были баджи
if ($('#main #left-menu #menu-recent .unread').length == 0) {
$('#main #left-menu #menu-recent').append('<span class="unread" style="display: none;">0</span>');
@ -1228,11 +1228,13 @@ function set_comments_refresh_tick() {
}
// Ставим тик
setInterval(comments_count_refresh_tick, 60000);
setInterval(function() {
comments_count_refresh_tick(current_options);
}, 60000);
}
// Проверка обновления комментариев, обновляется по крону
function comments_count_refresh_tick() {
function comments_count_refresh_tick(current_options) {
$('#debug_iframe').remove();
var iframe = document.createElement('iframe');
document.body.appendChild(iframe);
@ -1278,6 +1280,14 @@ function comments_count_refresh_tick() {
$('#main #left-menu #menu-comments .unread').text('0').hide();
}
if (current_options.option_other_comments_count_refresh_title.value == true) {
var new_title = document.title.replace(new RegExp('^\\[[0-9]+\\; [0-9]+\\] '), '');
if ((count_recent > 0) || (count_comments > 0)) {
new_title = '[' + count_recent + '; ' + count_comments + '] ' + new_title;
}
document.title = new_title;
}
$('#debug_iframe').remove();
}).attr({
// Из-за Same Origin'а я дёргаю несуществующую страницу на том же домене, чтобы получить баджи и,

View File

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

View File

@ -177,6 +177,10 @@
<div class="option-node">
<input type="checkbox" class="option-boolean" id="option-other-comments-count-refresh"><label for="option-other-comments-count-refresh" data-i18n="option_other_comments_count_refresh"></label>
<div class="option-node">
<input type="checkbox" class="option-boolean" id="option-other-comments-count-refresh-title"><label for="option-other-comments-count-refresh-title" data-i18n="option_other_comments_count_refresh_title"></label>
</div>
</div>
<div class="option-node">