mirror of
https://bitbucket.org/skobkin/chrome_point_plus.git
synced 2024-11-23 18:56:04 +00:00
Some refucktoring and fixes.
This commit is contained in:
parent
b4a039843d
commit
882f6627a8
|
@ -223,7 +223,7 @@ div#markItUpText-input {
|
||||||
height: 30em !important;
|
height: 30em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
#new-post-form .draft_save_status{
|
#new-post-form #draft-save-status {
|
||||||
display: none;
|
display: none;
|
||||||
padding: 3px 5px;
|
padding: 3px 5px;
|
||||||
color: green;
|
color: green;
|
||||||
|
|
|
@ -59,6 +59,7 @@ $(document).ready(function() {
|
||||||
$('.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));
|
||||||
|
|
||||||
|
// @todo: вынести в отдельный шаблон
|
||||||
$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'))
|
||||||
|
@ -910,7 +911,7 @@ function space_key_event() {
|
||||||
/* Автосохранение черновиков */
|
/* Автосохранение черновиков */
|
||||||
var draft_last_text = ''; // Последний зафиксированный текст
|
var draft_last_text = ''; // Последний зафиксированный текст
|
||||||
function draft_restore() {
|
function draft_restore() {
|
||||||
chrome.storage.sync.get('point_draft_text', function(items) {
|
chrome.storage.local.get('point_draft_text', function(items) {
|
||||||
$('#new-post-form #text-input').val(items.point_draft_text);
|
$('#new-post-form #text-input').val(items.point_draft_text);
|
||||||
draft_last_text = items.point_draft_text;
|
draft_last_text = items.point_draft_text;
|
||||||
});
|
});
|
||||||
|
@ -918,7 +919,7 @@ function draft_restore() {
|
||||||
|
|
||||||
function draft_set_save_handler() {
|
function draft_set_save_handler() {
|
||||||
setInterval(draft_save_check, 5000);
|
setInterval(draft_save_check, 5000);
|
||||||
$('#new-post-wrap .footnote').html($('#new-post-wrap .footnote').html() + '<div class="draft_save_status"></div>');
|
$('#new-post-wrap .footnote').append($('<div id="draft-save-status">'));
|
||||||
}
|
}
|
||||||
|
|
||||||
var draft_save_busy = false;
|
var draft_save_busy = false;
|
||||||
|
@ -928,24 +929,23 @@ function draft_save_check() {
|
||||||
}
|
}
|
||||||
draft_save_busy = true;
|
draft_save_busy = true;
|
||||||
|
|
||||||
// Видишь поиск id внутри id?.. ненавидишь меня?
|
|
||||||
var current_text = $('#new-post-form #text-input').val();
|
var current_text = $('#new-post-form #text-input').val();
|
||||||
if (draft_last_text == current_text) {
|
if (draft_last_text == current_text) {
|
||||||
draft_save_busy = false;
|
draft_save_busy = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// @todo i18n
|
// @todo i18n
|
||||||
$('.draft_save_status').text('Сохраняем черновик...').show();
|
$('#draft-save-status').text('Сохраняем черновик...').show();
|
||||||
|
|
||||||
// Сохраняем
|
// Сохраняем
|
||||||
draft_last_text = current_text;
|
draft_last_text = current_text;
|
||||||
// Save it using the Chrome extension storage API.
|
// Save it using the Chrome extension storage API.
|
||||||
chrome.storage.sync.set({'point_draft_text': draft_last_text}, function() {
|
chrome.storage.local.set({'point_draft_text': draft_last_text}, function() {
|
||||||
// Notify that we saved.
|
// Notify that we saved.
|
||||||
draft_save_busy = false;
|
draft_save_busy = false;
|
||||||
$('.draft_save_status').text('Черновик сохранён...');
|
$('#draft-save-status').text('Черновик сохранён...');
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
$('.draft_save_status').fadeOut(500);
|
$('#draft-save-status').fadeOut(1000);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue