From b4a039843d17009611d4ca88aaca623dc6f810c0 Mon Sep 17 00:00:00 2001 From: Alexey Skobkin Date: Thu, 27 Nov 2014 00:24:34 +0400 Subject: [PATCH] Some refucktoring. --- chrome_point_plus/css/point-plus.css | 23 +++++++---------------- chrome_point_plus/js/point-plus.js | 22 +++++++--------------- 2 files changed, 14 insertions(+), 31 deletions(-) diff --git a/chrome_point_plus/css/point-plus.css b/chrome_point_plus/css/point-plus.css index 5957d16..e71bd12 100644 --- a/chrome_point_plus/css/point-plus.css +++ b/chrome_point_plus/css/point-plus.css @@ -213,14 +213,6 @@ div#markItUpText-input { -webkit-filter: blur(30px); } -/* point-plus-debug */ -.point-plus-debug{ - float: right; - display: block; - color: rgba(255,255,255,.75); - padding: 10px 0px; -} - .post-tag-nsfw.hide-nsfw-posts, .post-tag-сиськи.hide-nsfw-posts{ display: none; @@ -237,11 +229,10 @@ div#markItUpText-input { color: green; } - - - - - - - - +/* point-plus-debug */ +#point-plus-debug{ + float: right; + display: block; + color: rgba(255,255,255,.75); + padding: 10px 0px; +} \ No newline at end of file diff --git a/chrome_point_plus/js/point-plus.js b/chrome_point_plus/js/point-plus.js index 678f5ba..6f20cde 100644 --- a/chrome_point_plus/js/point-plus.js +++ b/chrome_point_plus/js/point-plus.js @@ -9,23 +9,15 @@ $(document).ready(function() { console.info('Point+ %s', getVersion()); // Проверяем, загрузились ли мы - // @todo: Убрать это говно и нормально пилить расширение не принося пользователям костыли - // Хочешь детект? Делай невидимый элемент где-нибудь в подвале. И айдишник, а не класс. Их искать быстрее. - // Хочешь показать пользователю обработку - делай индикатор и встраивай в интерфейс сайта. - 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')); + var point_plus_debug = $('#point-plus-debug'); + if (point_plus_debug.length > 0) { + console.error('Point+ %s already loaded.', point_plus_debug.data('point-plus-version')); return; } - point_plus_debug = null; - var new_div = document.createElement('div'); - $(new_div).attr({ + $('
').attr({ 'data-point-plus-version': getVersion() - }).addClass('point-plus-debug').text('Point+ v' + getVersion() + ' loading...'); - var obj = $('#user-menu-cb')[0]; - obj.parentElement.insertBefore(new_div, obj); - new_div = null; - obj = null; + }).text('Point+ ' + getVersion() + ' loading...') + .insertBefore('#user-menu-cb'); // Черновики. Ставим хандлер и восстанавливаем предыдущее состояние draft_set_save_handler(); @@ -529,7 +521,7 @@ $(document).ready(function() { set_space_key_skip_handler(); } - $('.point-plus-debug').fadeOut(500); + $('#point-plus-debug').fadeOut(1000); }); });