use spaces for indentation in js files

This commit is contained in:
maxpozdeev 2022-07-10 15:50:05 +03:00
parent 6f60e75c45
commit 000b9f6eac
4 changed files with 2530 additions and 2531 deletions

View file

@ -6,7 +6,7 @@ root = true
[*]
charset = utf-8
end_of_line = lf
# tab_width here used only to represent tabs if indent_size is not set
# tab_width here is only used to represent tabs if indent_size is not set
tab_width = 4
trim_trailing_whitespace = true
insert_final_newline = true
@ -15,9 +15,8 @@ insert_final_newline = true
indent_style = space
indent_size = 4
# temporary. spaces will be used later.
[*.js]
indent_style = tab
indent_style = space
tab_width = 4
[*.{css,yml,html,svg}]

View file

@ -33,16 +33,16 @@
// Detect touch support - Windows Surface devices and other touch devices
$.support.mspointer = window.navigator.msPointerEnabled;
$.support.touch = ( 'ontouchstart' in document
|| 'ontouchstart' in window
|| window.TouchEvent
|| (window.DocumentTouch && document instanceof DocumentTouch)
|| navigator.maxTouchPoints > 0
|| navigator.msMaxTouchPoints > 0
|| 'ontouchstart' in window
|| window.TouchEvent
|| (window.DocumentTouch && document instanceof DocumentTouch)
|| navigator.maxTouchPoints > 0
|| navigator.msMaxTouchPoints > 0
);
// Ignore browsers without touch or mouse support
if ((!$.support.touch && !$.support.mspointer) || !$.ui.mouse) {
return;
return;
}
var mouseProto = $.ui.mouse.prototype,
@ -50,11 +50,11 @@
_mouseDestroy = mouseProto._mouseDestroy,
touchHandled;
var delay = 300,
delayTimer,
delayEvent,
delayStarted = false,
delayFinished = false;
var delay = 300,
delayTimer,
delayEvent,
delayStarted = false,
delayFinished = false;
/**
@ -111,37 +111,37 @@
event.target.dispatchEvent(simulatedEvent);
}
function startDelayTimer (event) {
clearTimeout(delayTimer);
delayEvent = event;
delayTimer = setTimeout(function() {
fireMouseDown.call(this);
}, delay);
delayStarted = true;
delayFinished = false;
}
function startDelayTimer (event) {
clearTimeout(delayTimer);
delayEvent = event;
delayTimer = setTimeout(function() {
fireMouseDown.call(this);
}, delay);
delayStarted = true;
delayFinished = false;
}
function fireMouseDown () {
function fireMouseDown () {
var self = this;
var self = this;
delayFinished = true;
delayFinished = true;
// Set the flag to prevent other widgets from inheriting the touch event
touchHandled = true;
// Set the flag to prevent other widgets from inheriting the touch event
touchHandled = true;
// Track movement to determine if interaction was a click
self._touchMoved = false;
// Track movement to determine if interaction was a click
self._touchMoved = false;
// Simulate the mouseover event
simulateMouseEvent(delayEvent, 'mouseover');
// Simulate the mouseover event
simulateMouseEvent(delayEvent, 'mouseover');
// Simulate the mousemove event
simulateMouseEvent(delayEvent, 'mousemove');
// Simulate the mousemove event
simulateMouseEvent(delayEvent, 'mousemove');
// Simulate the mousedown event
simulateMouseEvent(delayEvent, 'mousedown');
}
// Simulate the mousedown event
simulateMouseEvent(delayEvent, 'mousedown');
}
/**
@ -163,9 +163,9 @@
return;
}
if (!delayStarted) {
startDelayTimer.call(self, event);
}
if (!delayStarted) {
startDelayTimer.call(self, event);
}
};
/**
@ -174,12 +174,12 @@
*/
mouseProto._touchMove = function (event) {
//
if (!delayFinished) {
delayStarted = false;
clearTimeout(delayTimer);
return;
}
//
if (!delayFinished) {
delayStarted = false;
clearTimeout(delayTimer);
return;
}
// Ignore event if not handled
if (!touchHandled) {
@ -199,12 +199,12 @@
*/
mouseProto._touchEnd = function (event) {
//
if (delayStarted) {
clearTimeout(delayTimer);
delayStarted = false;
fireMouseDown();
}
//
if (delayStarted) {
clearTimeout(delayTimer);
delayStarted = false;
fireMouseDown();
}
// Ignore event if not handled
if (!touchHandled) {

File diff suppressed because it is too large Load diff

View file

@ -1,7 +1,7 @@
/*
This file is a part of myTinyTodo.
(C) Copyright 2010,2020,2022 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
This file is a part of myTinyTodo.
(C) Copyright 2010,2020,2022 Max Pozdeev <maxpozdeev@gmail.com>
Licensed under the GNU GPL version 2 or any later. See file COPYRIGHT for details.
*/
(function(){
@ -12,373 +12,373 @@ var mtt;
function MytinytodoAjaxApi(amtt)
{
mtt = amtt;
mtt = amtt;
}
window.MytinytodoAjaxApi = MytinytodoAjaxApi;
MytinytodoAjaxApi.prototype =
{
/* required method */
request: function(action, params, callback)
{
if (!this[action]) throw "Unknown ApiDriver action: " + action;
/* required method */
request: function(action, params, callback)
{
if (!this[action]) throw "Unknown ApiDriver action: " + action;
this[action] (params, function(json){
if (json.denied) mtt.errorDenied();
if (callback) callback.call(mtt, json)
});
},
this[action] (params, function(json){
if (json.denied) mtt.errorDenied();
if (callback) callback.call(mtt, json)
});
},
loadTasks: function(params, callback)
{
var q = '';
if (params.search && params.search != '') q += '&s=' + encodeURIComponent(params.search);
if (params.tag && params.tag != '') q += '&t=' + encodeURIComponent(params.tag);
if (params.setCompl && params.setCompl != 0) q += '&setCompl=1';
loadTasks: function(params, callback)
{
var q = '';
if (params.search && params.search != '') q += '&s=' + encodeURIComponent(params.search);
if (params.tag && params.tag != '') q += '&t=' + encodeURIComponent(params.tag);
if (params.setCompl && params.setCompl != 0) q += '&setCompl=1';
$.getJSON(mtt.apiUrl + 'tasks?list='+params.list+'&compl='+params.compl+'&sort='+params.sort+q, callback);
},
$.getJSON(mtt.apiUrl + 'tasks?list='+params.list+'&compl='+params.compl+'&sort='+params.sort+q, callback);
},
newTask: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks',
method: 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'simple',
list: params.list,
title: params.title,
tag: params.tag,
}),
success: callback,
dataType: 'json'
});
},
newTask: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks',
method: 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'simple',
list: params.list,
title: params.title,
tag: params.tag,
}),
success: callback,
dataType: 'json'
});
},
fullNewTask: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks',
method: 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'full',
list: params.list,
title: params.title,
note: params.note,
prio: params.prio,
tags: params.tags,
duedate: params.duedate,
/* tag: params.tag, // We do not send current tag filter, autotag should set it in the form and include in tags */
}),
success: callback,
dataType: 'json'
});
},
fullNewTask: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks',
method: 'POST',
contentType : 'application/json',
data: JSON.stringify({
action: 'full',
list: params.list,
title: params.title,
note: params.note,
prio: params.prio,
tags: params.tags,
duedate: params.duedate,
/* tag: params.tag, // We do not send current tag filter, autotag should set it in the form and include in tags */
}),
success: callback,
dataType: 'json'
});
},
editTask: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'edit',
title: params.title,
note: params.note,
prio: params.prio,
tags: params.tags,
duedate: params.duedate,
}),
success: callback,
dataType: 'json'
});
},
editTask: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'edit',
title: params.title,
note: params.note,
prio: params.prio,
tags: params.tags,
duedate: params.duedate,
}),
success: callback,
dataType: 'json'
});
},
editNote: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'note',
note: params.note
}),
success: callback,
dataType: 'json'
});
},
editNote: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'note',
note: params.note
}),
success: callback,
dataType: 'json'
});
},
completeTask: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'complete',
compl: params.compl
}),
success: callback,
dataType: 'json'
});
},
completeTask: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'complete',
compl: params.compl
}),
success: callback,
dataType: 'json'
});
},
deleteTask: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: 'DELETE',
success: callback,
dataType: 'json'
});
},
deleteTask: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: 'DELETE',
success: callback,
dataType: 'json'
});
},
setTaskPriority: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'priority',
prio: params.priority,
}),
success: callback,
dataType: 'json'
});
},
setTaskPriority: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'priority',
prio: params.priority,
}),
success: callback,
dataType: 'json'
});
},
changeOrder: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks',
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'order',
order: params.order,
}),
success: callback,
dataType: 'json'
});
},
changeOrder: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks',
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'order',
order: params.order,
}),
success: callback,
dataType: 'json'
});
},
suggestTags: function(params, callback)
{
$.getJSON(mtt.apiUrl + 'suggestTags', {list:params.list, q:params.q}, callback);
},
suggestTags: function(params, callback)
{
$.getJSON(mtt.apiUrl + 'suggestTags', {list:params.list, q:params.q}, callback);
},
tagCloud: function(params, callback)
{
$.getJSON(mtt.apiUrl + 'tagCloud/' + encodeURIComponent(params.list), callback);
},
tagCloud: function(params, callback)
{
$.getJSON(mtt.apiUrl + 'tagCloud/' + encodeURIComponent(params.list), callback);
},
moveTask: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'move',
from: params.from,
to: params.to
}),
success: callback,
dataType: 'json'
});
},
moveTask: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks/' + encodeURIComponent(params.id),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'move',
from: params.from,
to: params.to
}),
success: callback,
dataType: 'json'
});
},
parseTaskStr: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks/parseTitle',
method: 'POST',
contentType : 'application/json',
data: JSON.stringify({
list: params.list,
title: params.title,
tag: params.tag ,
}),
success: callback,
dataType: 'json'
});
},
parseTaskStr: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'tasks/parseTitle',
method: 'POST',
contentType : 'application/json',
data: JSON.stringify({
list: params.list,
title: params.title,
tag: params.tag ,
}),
success: callback,
dataType: 'json'
});
},
// Lists
loadLists: function(params, callback)
{
$.getJSON(mtt.apiUrl + 'lists', callback);
},
// Lists
loadLists: function(params, callback)
{
$.getJSON(mtt.apiUrl + 'lists', callback);
},
addList: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists',
method: 'POST',
contentType : 'application/json',
data: JSON.stringify({
name: params.name,
}),
success: callback,
dataType: 'json'
});
addList: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists',
method: 'POST',
contentType : 'application/json',
data: JSON.stringify({
name: params.name,
}),
success: callback,
dataType: 'json'
});
},
},
deleteList: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: 'DELETE',
success: callback,
dataType: 'json'
});
},
deleteList: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: 'DELETE',
success: callback,
dataType: 'json'
});
},
renameList: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'rename',
name: params.name,
}),
success: callback,
dataType: 'json'
});
},
renameList: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'rename',
name: params.name,
}),
success: callback,
dataType: 'json'
});
},
setSort: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'sort',
name: params.name,
sort: params.sort
}),
success: callback,
dataType: 'json'
});
},
setSort: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'sort',
name: params.name,
sort: params.sort
}),
success: callback,
dataType: 'json'
});
},
publishList: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'publish',
publish: params.publish,
}),
success: callback,
dataType: 'json'
});
},
publishList: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'publish',
publish: params.publish,
}),
success: callback,
dataType: 'json'
});
},
setShowNotesInList: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'showNotes',
shownotes: params.shownotes,
}),
success: callback,
dataType: 'json'
});
},
setShowNotesInList: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'showNotes',
shownotes: params.shownotes,
}),
success: callback,
dataType: 'json'
});
},
setHideList: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'hide',
hide: params.hide,
}),
success: callback,
dataType: 'json'
});
},
setHideList: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'hide',
hide: params.hide,
}),
success: callback,
dataType: 'json'
});
},
changeListOrder: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists',
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'order',
order: params.order
}),
success: callback,
dataType: 'json'
});
},
changeListOrder: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists',
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'order',
order: params.order
}),
success: callback,
dataType: 'json'
});
},
clearCompletedInList: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'clearCompleted',
}),
success: callback,
dataType: 'json'
});
},
clearCompletedInList: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'lists/' + encodeURIComponent(params.list),
method: 'PUT',
contentType : 'application/json',
data: JSON.stringify({
action: 'clearCompleted',
}),
success: callback,
dataType: 'json'
});
},
/* Auth */
/* Auth */
login: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'login',
method: 'POST',
contentType : 'application/json',
data: JSON.stringify({
password: params.password,
}),
success: callback,
dataType: 'json'
});
},
login: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'login',
method: 'POST',
contentType : 'application/json',
data: JSON.stringify({
password: params.password,
}),
success: callback,
dataType: 'json'
});
},
logout: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'logout',
method: 'POST',
success: callback,
dataType: 'json'
});
}
logout: function(params, callback)
{
$.ajax({
url: mtt.apiUrl + 'logout',
method: 'POST',
success: callback,
dataType: 'json'
});
}
};