scratch

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 96  →  ?path2? @ 95
/text.html
@@ -179,36 +179,32 @@
var autoSaveTimeoutID;
function saveTextFile() {
$.get('session.php').then((token) => {
$.post('text.php', {
data: $('#trumbowyg').trumbowyg('html'),
token: token,
fingerprint: result,
action: 'SAVE',
token: token
}).done((data) => {
$.post('text.php', {
data: $('#trumbowyg').trumbowyg('html'),
fingerprint: result,
action: 'SAVE'
}).done((data) => {
// Visual feedback for a successful save.
$('#editorpanel')
.delay(250)
.velocity(
{
borderColor: '#ff99ff'
},
200)
.delay(500)
.velocity(
{
borderColor: '#ecf0f1'
},
200);
// Visual feedback for a successful save.
$('#editorpanel')
.delay(250)
.velocity(
{
borderColor: '#ff99ff'
},
200)
.delay(500)
.velocity(
{
borderColor: '#ecf0f1'
},
200);
}).fail(() => {
// Reschedule saving of the file.
if(autoSaveTimeoutID)
window.clearTimeout(autoSaveTimeoutID);
autoSaveTimeoutID = window.setTimeout(saveTextFile, 250);
});
}).fail(() => {
// Reschedule saving of the file.
if(autoSaveTimeoutID)
window.clearTimeout(autoSaveTimeoutID);
autoSaveTimeoutID = window.setTimeout(saveTextFile, 250);
});
}
@@ -228,22 +224,19 @@
// Retrieve the contents of the shared file.
$('#trumbowyg').trumbowyg('disable');
$.get('session.php').then((token) => {
$.post('text.php',
{
timestamp: window.performance.now(),
fingerprint: result,
action: 'LOAD',
token: token
}).done((data) => {;
$('#trumbowyg')
.trumbowyg('html', data);
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
}).fail(() => {
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
});
$.post('text.php',
{
timestamp: window.performance.now(),
fingerprint: result,
action: 'LOAD'
}).done((data) => {;
$('#trumbowyg')
.trumbowyg('html', data);
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
}).fail(() => {
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
});
$('#save').click(() => {
@@ -256,31 +249,29 @@
),
'.html'
);
$.get('session.php').then((token) => {
formData.append('token', token);
$.ajax({
url: 'file.php',
//type: 'POST',
data: formData,
// cache: false // FF
processData: false,
contentType: false
}).done((data) => {
// Serialize JSON to object.
data = JSON.parse(data);
$.ajax({
url: 'file.php',
type: 'POST',
data: formData,
// cache: false // FF
processData: false,
contentType: false
}).done((data) => {
// Serialize JSON to object.
data = JSON.parse(data);
$('#URL')
.val(
location.protocol
.concat("//")
.concat(window.location.hostname)
.concat("/")
.concat(data.hash)
);
$('#trumbowyg').trumbowyg('enable');
}).fail(() => {
$('#trumbowyg').trumbowyg('enable');
});
$('#URL')
.val(
location.protocol
.concat("//")
.concat(window.location.hostname)
.concat("/")
.concat(data.hash)
);
$('#trumbowyg').trumbowyg('enable');
}).fail(() => {
$('#trumbowyg').trumbowyg('enable');
});
});
@@ -294,28 +285,25 @@
// Retrieve the contents of the shared file.
$('#editor').trumbowyg('disable');
$.get('session.php').then((token) => {
$.post('text.php',
{
timestamp: window.performance.now(),
fingerprint: nick,
action: 'LOAD',
token: token
}).done((data) => {;
$('#trumbowyg')
.trumbowyg('html', data);
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
$.post('text.php',
{
timestamp: window.performance.now(),
fingerprint: nick,
action: 'LOAD'
}).done((data) => {;
$('#trumbowyg')
.trumbowyg('html', data);
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
if(fingerprint == nick)
$('#home-icon').addClass("text-success").removeClass("text-danger");
else
$('#home-icon').addClass("text-danger").removeClass("text-success");
if(fingerprint == nick)
$('#home-icon').addClass("text-success").removeClass("text-danger");
else
$('#home-icon').addClass("text-danger").removeClass("text-success");
}).fail(() => {
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
});
}).fail(() => {
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
});
});
@@ -331,28 +319,25 @@
// Retrieve the contents of the shared file.
$('#editor').trumbowyg('disable');
$.get('session.php').then((token) => {
$.post('text.php',
{
timestamp: window.performance.now(),
fingerprint: nick,
action: 'LOAD',
token: token
}).done((data) => {;
$('#trumbowyg')
.trumbowyg('html', data);
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
$.post('text.php',
{
timestamp: window.performance.now(),
fingerprint: nick,
action: 'LOAD'
}).done((data) => {;
$('#trumbowyg')
.trumbowyg('html', data);
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
if(fingerprint == nick)
$('#home-icon').addClass("text-success").removeClass("text-danger");
else
$('#home-icon').addClass("text-danger").removeClass("text-success");
if(fingerprint == nick)
$('#home-icon').addClass("text-success").removeClass("text-danger");
else
$('#home-icon').addClass("text-danger").removeClass("text-success");
}).fail(() => {
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
});
}).fail(() => {
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
});
});
@@ -366,27 +351,24 @@
// Retrieve the contents of the shared file.
$('#editor').trumbowyg('disable');
$.get('session.php').then((token) => {
$.post('text.php',
{
timestamp: window.performance.now(),
fingerprint: nick,
action: 'LOAD',
token: token
}).done((data) => {;
$('#trumbowyg')
.trumbowyg('html', data);
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
$.post('text.php',
{
timestamp: window.performance.now(),
fingerprint: nick,
action: 'LOAD'
}).done((data) => {;
$('#trumbowyg')
.trumbowyg('html', data);
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
if(fingerprint == nick)
$('#home-icon').addClass("text-success").removeClass("text-danger");
else
$('#home-icon').addClass("text-danger").removeClass("text-success");
}).fail(() => {
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
});
if(fingerprint == nick)
$('#home-icon').addClass("text-success").removeClass("text-danger");
else
$('#home-icon').addClass("text-danger").removeClass("text-success");
}).fail(() => {
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
});
});
@@ -399,26 +381,23 @@
// Retrieve the contents of the shared file.
$('#editor').trumbowyg('disable');
$.get('session.php').then((token) => {
$.post('text.php',
{
timestamp: window.performance.now(),
fingerprint: fingerprint,
action: 'LOAD',
token: token
}).done((data) => {;
$('#trumbowyg')
.trumbowyg('html', data);
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
if(fingerprint == nick)
$('#home-icon').addClass("text-success").removeClass("text-danger");
else
$('#home-icon').addClass("text-danger").removeClass("text-success");
}).fail(() => {
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
});
$.post('text.php',
{
timestamp: window.performance.now(),
fingerprint: fingerprint,
action: 'LOAD'
}).done((data) => {;
$('#trumbowyg')
.trumbowyg('html', data);
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
if(fingerprint == nick)
$('#home-icon').addClass("text-success").removeClass("text-danger");
else
$('#home-icon').addClass("text-danger").removeClass("text-success");
}).fail(() => {
$('#trumbowyg').trumbowyg('enable');
$('#trumbowyg').show();
});
});
});