From e71e7cfce624d1f16f1596c2be3ed342ac645b61 Mon Sep 17 00:00:00 2001
From: Erwan ');
}
-
+
place.append(divComment);
}
$('div#comments').append('');
@@ -186,7 +186,7 @@ function open_reply(source, commentid) {
if ($(this).val() == $(this).attr('title')) {
$(this).val('');
}
- });
+ });
$('textarea#replymessage').focus();
}
@@ -199,8 +199,8 @@ function send_comment(parentid) {
if ($('textarea#replymessage').val().length==0) {
return;
}
-
- showStatus('Sending comment...', spin=true);
+
+ showStatus('Sending comment...', spin=true);
var cipherdata = zeroCipher(pageKey(), $('textarea#replymessage').val());
var ciphernickname = '';
var nick=$('input#nickname').val();
@@ -223,10 +223,10 @@ function send_comment(parentid) {
location.reload();
}
else if (data.status==1) {
- showError('Could not post comment: '+data.message);
+ showError('Could not post comment: '+data.message);
}
else {
- showError('Could not post comment.');
+ showError('Could not post comment.');
}
});
}
@@ -239,13 +239,13 @@ function send_data() {
if ($('textarea#message').val().length == 0) {
return;
}
- showStatus('Sending paste...', spin=true);
+ showStatus('Sending paste...', spin=true);
var randomkey = sjcl.codec.base64.fromBits(sjcl.random.randomWords(8, 0), 0);
var cipherdata = zeroCipher(randomkey, $('textarea#message').val());
var data_to_send = { data: cipherdata,
expire: $('select#pasteExpiration').val(),
opendiscussion: $('input#opendiscussion').is(':checked') ? 1 : 0
- };
+ };
$.post(scriptLocation(), data_to_send, 'json')
.error(function() {
showError('Data could not be sent (serveur error or not responding).');
@@ -253,21 +253,21 @@ function send_data() {
.success(function(data) {
if (data.status == 0) {
stateExistingPaste();
- var url = scriptLocation() + "?" + data.id + '#' + randomkey;
+ var url = scriptLocation() + "?" + data.id + '#' + randomkey;
showStatus('');
$('div#pastelink').html('Your paste is ' + url + '');
$('div#pastelink')
- .append(' ')
+ .append(' ')
.show();
- setElementText($('div#cleartext'), $('textarea#message').val());
- urls2links($('div#cleartext'));
+ setElementText($('div#cleartext'), $('textarea#message').val());
+ urls2links($('div#cleartext'));
showStatus('');
}
else if (data.status==1) {
- showError('Could not create paste: '+data.message);
+ showError('Could not create paste: '+data.message);
}
else {
- showError('Could not create paste.');
+ showError('Could not create paste.');
}
});
}
@@ -297,15 +297,15 @@ function stateNewPaste() {
*/
function stateExistingPaste() {
$('button#sendbutton').hide();
-
+
// No "clone" for IE<10.
if ($('div#oldienotice').is(":visible")) {
- $('button#clonebutton').hide();
+ $('button#clonebutton').hide();
}
else {
- $('button#clonebutton').show();
+ $('button#clonebutton').show();
}
-
+
$('div#expiration').hide();
$('div#language').hide();
$('input#password').hide();
@@ -346,20 +346,20 @@ function showError(message) {
/**
* Display status
* (We use the same function for paste and reply to comments)
- *
+ *
* @param string message : text to display
* @param boolean spin (optional) : tell if the "spinning" animation should be displayed.
*/
function showStatus(message, spin) {
$('div#replystatus').removeClass('errorMessage');
$('div#replystatus').text(message);
- if (!message) {
- $('div#status').html(' ');
+ if (!message) {
+ $('div#status').html(' ');
return;
}
if (message == '') {
- $('div#status').html(' ');
- return;
+ $('div#status').html(' ');
+ return;
}
$('div#status').removeClass('errorMessage');
$('div#status').text(message);
@@ -385,7 +385,7 @@ function shortenUrl(url) {
* http://localhost:8800/zero/?6f09182b8ea51997#WtLEUO5Epj9UHAV9JFs+6pUQZp13TuspAUjnF+iM+dM=
* http://user:password@localhost:8800/zero/?6f09182b8ea51997#WtLEUO5Epj9UHAV9JFs+6pUQZp13TuspAUjnF+iM+dM=
*
- *
+ *
* @param object element : a jQuery DOM element.
* @FIXME: add ppa & apt links.
*/
@@ -401,17 +401,17 @@ function urls2links(element) {
*/
function pageKey() {
var key = window.location.hash.substring(1); // Get key
-
+
// Some stupid web 2.0 services and redirectors add data AFTER the anchor
// (such as &utm_source=...).
// We will strip any additional data.
-
+
// First, strip everything after the equal sign (=) which signals end of base64 string.
i = key.indexOf('='); if (i>-1) { key = key.substring(0,i+1); }
-
+
// If the equal sign was not present, some parameters may remain:
i = key.indexOf('&'); if (i>-1) { key = key.substring(0,i); }
-
+
// Then add trailing equal sign if it's missing
if (key.charAt(key.length-1)!=='=') key+='=';
@@ -433,18 +433,18 @@ $(function() {
// Display an existing paste
if ($('div#cipherdata').text().length > 1) {
- // Missing decryption key in URL ?
+ // Missing decryption key in URL ?
if (window.location.hash.length == 0) {
showError('Cannot decrypt paste: Decryption key missing in URL (Did you use a redirector or an URL shortener which strips part of the URL ?)');
return;
}
-
+
// List of messages to display
var messages = jQuery.parseJSON($('div#cipherdata').text());
-
- // Show proper elements on screen.
+
+ // Show proper elements on screen.
stateExistingPaste();
-
+
displayMessages(pageKey(), messages);
}
// Display error message from php code.