Closed #68
This commit is contained in:
parent
ac1997d4d0
commit
d170e3b526
6 changed files with 36 additions and 2 deletions
|
@ -2,6 +2,12 @@ $(function()
|
|||
{
|
||||
function onDomUpdate()
|
||||
{
|
||||
$('form.edit-comment textarea, form.add-comment textarea')
|
||||
.bind('change keyup', function(e)
|
||||
{
|
||||
enableExitConfirmation();
|
||||
});
|
||||
|
||||
$('form.edit-comment, form.add-comment').submit(function(e)
|
||||
{
|
||||
e.preventDefault();
|
||||
|
@ -41,6 +47,8 @@ $(function()
|
|||
}
|
||||
else
|
||||
{
|
||||
disableExitConfirmation();
|
||||
|
||||
formDom.find('.preview').hide();
|
||||
var cb = function()
|
||||
{
|
||||
|
|
|
@ -272,3 +272,18 @@ $(function()
|
|||
Mousetrap.bind('d', function() { var url = $('.paginator:visible .next:not(.disabled) a').attr('href'); if (typeof url !== 'undefined') window.location.href = url; }, 'keyup');
|
||||
Mousetrap.bind('p', function() { $('.post a').eq(0).focus(); return false; }, 'keyup');
|
||||
});
|
||||
|
||||
|
||||
|
||||
function enableExitConfirmation()
|
||||
{
|
||||
$(window).bind('beforeunload', function(e)
|
||||
{
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
function disableExitConfirmation()
|
||||
{
|
||||
$(window).unbind('beforeunload');
|
||||
}
|
||||
|
|
|
@ -136,6 +136,7 @@ $(function()
|
|||
|
||||
function uploadFinished()
|
||||
{
|
||||
disableExitConfirmation();
|
||||
window.location.href = $('#upload-step2').attr('data-redirect-url');
|
||||
}
|
||||
|
||||
|
@ -224,6 +225,7 @@ $(function()
|
|||
{
|
||||
for (var i = 0; i < inputs.length; i ++)
|
||||
{
|
||||
enableExitConfirmation();
|
||||
var input = inputs[i];
|
||||
var postDom = $('#post-template').clone(true);
|
||||
postDom.find('form').submit(false);
|
|
@ -12,6 +12,7 @@ $(function()
|
|||
aDom.addClass('inactive');
|
||||
|
||||
var formDom = $('form.edit-post');
|
||||
formDom.data('original-data', formDom.serialize());
|
||||
if (formDom.find('.tagit').length == 0)
|
||||
{
|
||||
$.getJSON('/tags?json', {filter: 'order:popularity,desc'}, function(data)
|
||||
|
@ -23,7 +24,13 @@ $(function()
|
|||
tagItOptions.availableTags = tags;
|
||||
tagItOptions.placeholderText = $('.tags input').attr('placeholder');
|
||||
$('.tags input').tagit(tagItOptions);
|
||||
|
||||
formDom.find('input[type=text]:visible:eq(0)').focus();
|
||||
formDom.find('textarea, input').bind('change keyup', function()
|
||||
{
|
||||
if (formDom.serialize() != formDom.data('original-data'))
|
||||
enableExitConfirmation();
|
||||
});
|
||||
});
|
||||
}
|
||||
else
|
||||
|
@ -89,6 +96,8 @@ $(function()
|
|||
{
|
||||
if (data['success'])
|
||||
{
|
||||
disableExitConfirmation();
|
||||
|
||||
$.get(window.location.href, function(data)
|
||||
{
|
||||
$('#sidebar').replaceWith($(data).find('#sidebar'));
|
||||
|
|
|
@ -180,8 +180,8 @@ class PostController
|
|||
*/
|
||||
public function uploadAction()
|
||||
{
|
||||
$this->context->stylesheets []= 'upload.css';
|
||||
$this->context->scripts []= 'upload.js';
|
||||
$this->context->stylesheets []= 'post-upload.css';
|
||||
$this->context->scripts []= 'post-upload.js';
|
||||
$this->context->subTitle = 'upload';
|
||||
PrivilegesHelper::confirmWithException(Privilege::UploadPost);
|
||||
if ($this->config->registration->needEmailForUploading)
|
||||
|
|
Loading…
Reference in a new issue