Newer
Older
$(this).remove();
});
}
});
return false;
});
$(document).on('click', '#new-note', function() {
var note = $(this).closest('.quicknote'),
T = $('<textarea>'),
button = $('<input type="button">').val(__('Create'));
button.click(function() {
$.post('ajax.php/' + note.data('url'),
{ note: T.redactor('get'), no_options: note.hasClass('no-options') },
function(response) {
$(T).redactor('destroy').replaceWith(note);
$(response).show('highlight').insertBefore(note.parent());
$('.submit', note.parent()).remove();
},
'html'
);
});
T.addClass('no-bar small');
note.replaceWith(T);
$('<p>').addClass('submit').css('text-align', 'center')
.append(button).appendTo(T.parent());
$.redact(T);
$(T).redactor('focus');
return false;
});
if ($.oststrings && $.oststrings[s])
return $.oststrings[s];
// Thanks, http://stackoverflow.com/a/487049
function addSearchParam(key, value) {
key = encodeURI(key); value = encodeURI(value);
var kvp = document.location.search.substr(1).split('&');
var i=kvp.length; var x;
while (i--) {
x = kvp[i].split('=');
if (x[0]==key) {
x[1] = value;
kvp[i] = x.join('=');
break;
}
}
if(i<0) {kvp[kvp.length] = [key,value].join('=');}
//this will reload the page, it's likely better to store this until finished
return kvp.join('&');