add bootstrap

This commit is contained in:
2018-06-13 23:16:53 +02:00
parent 76faf824fc
commit 6ee27fda3d
151 changed files with 21257 additions and 1745 deletions

View File

@@ -1,21 +1,22 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="author" content="Franzz" />
<link href="style/mythoughts.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="scripts/jquery.min.js"></script>
<script type="text/javascript" src="scripts/quill.min.js"></script>
<script type="text/javascript" src="scripts/functions.js"></script>
<script type="text/javascript" src="scripts/mythoughts.js"></script>
<link rel="shortcut icon" href="images/favicon2.ico" />
<title>My Thoughts</title>
<script type="text/javascript">
var oMyThoughts = new MyThoughts(asGlobalVars);
$(document).ready(oMyThoughts.init);
</script>
</head>
<body>
<div id="container"></div>
</body>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="author" content="Franzz" />
<link href="style/mythoughts.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="scripts/jquery.min.js"></script>
<script type="text/javascript" src="scripts/bootstrap.bundle.min.js"></script>
<script type="text/javascript" src="scripts/quill.min.js"></script>
<script type="text/javascript" src="scripts/functions.js"></script>
<script type="text/javascript" src="scripts/mythoughts.js"></script>
<link rel="shortcut icon" href="images/favicon2.ico" />
<title>My Thoughts</title>
<script type="text/javascript">
var oMyThoughts = new MyThoughts(asGlobalVars);
$(document).ready(oMyThoughts.init);
</script>
</head>
<body>
<div id="container"></div>
</body>
</html>

9
masks/logoff.html Normal file
View File

@@ -0,0 +1,9 @@
<div id="logoff">Bye...</div>
<script type="text/javascript">
oMyThoughts.pageInit = function(asHash, bFirstPage)
{
document.cookie = self.consts.cookie+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC";
location.href = self.consts.root;
};
</script>

View File

@@ -1,56 +1,95 @@
<div id="logon">
<form name="post_logon" id="post_logon">
<div class="credentials">
<p><input type="text" name="login" id="login" value="" /></p>
<p><input type="password" name="pass" id="pass" /></p>
<div id="logon" class="border border-grey-400 shadow rounded">
<form name="post_logon" id="post_logon" method="post">
<div class="form-group align-items-center">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fal fa-user"></i></span>
</div>
<input type="text" class="form-control" placeholder="Nickname" name="login" id="login" value="Franzz" />
</div>
</div>
<p class="register"><input type="button" name="register" id="register" value="No account?" /></p>
<p><input type="button" name="ok" id="ok" class="connection" value="Ok" /></p>
</form>
<div class="form-group align-items-center">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text"><i class="fal fa-password"></i></span>
</div>
<input type="password" class="form-control" placeholder="Password" name="pass" id="pass" value="123456" />
</div>
</div>
<div id="pass_conf_box" class="form-group align-items-center collapse">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
<i class="fal fa-password first"></i>
<i class="fal fa-password second"></i>
</span>
</div>
<input type="password" class="form-control" placeholder="Confirm password" name="pass_conf" id="pass_conf" value="123456" />
</div>
</div>
<div id="btn_box" class="btn-toolbar justify-content-between" role="toolbar">
<button type="button" class="btn btn-secondary shadow-sm transition" id="register">Register</button>
<button type="button" class="btn btn-primary shadow-sm" name="signin" id="signin">Sign in</button>
</div>
</form>
</div>
<script type="text/javascript">
oMyThoughts.pageInit = function(asHash, bFirstPage)
{
$('#logon').hide();
$('#login').addDefaultValue('Nickname');
$('#pass').addDefaultValue('Password');
self.elem.$Main.addClass('no_frame');
$(window).keyup(function(e){if(e.which==13) logMeIn();});
$('#ok').click(logMeIn);
$('#register').click(register);
$('#logon').fadeIn('slow');
//$(window).keyup(function(e){if(e.which==13) logMeIn();});
$('#signin').click(logMeIn);
$('#register').on('click submit', function(event){
event.preventDefault();
$(this)
.blur()
.off('click')
.click(register);
$('#pass_conf_box').collapse('show');
$('#signin').hide('fast', function(){$('#btn_box').addClass('registering');});
});
};
function logMeIn()
{
var sLogin = $.trim(removeDiacritics($('#login').val().toLowerCase()));
var sPass = $.trim($('#pass').val());
if($('#post_logon').checkForm())
var oChecker = $('#post_logon').checkForm('#login, #pass');
if(oChecker.success)
{
getInfo
(
var asInputs = getInputs();
Tools.ajax(
'logmein',
oMyThoughts.loadHome,
{token:md5(sLogin)+oMyThoughts.consts.token_sep+getLoginToken(sPass)},
function(sDesc){feedback('error', sDesc);}
{token: getToken(asInputs)},
);
}
else feedback('warning', 'incomplete form');
else Tools.feedback('warning', oChecker.desc);
}
function register()
{
if($('#post_logon').checkForm('#login'))
var oChecker = $('#post_logon').checkForm();
if(oChecker.success)
{
getInfo
(
var asInputs = getInputs();
Tools.ajax(
'register',
oMyThoughts.loadHome,
{nickname:$('#login').val()},
function(sDesc){feedback('error', sDesc);}
{token: getToken(asInputs), nickname:asInputs.nickname}
);
}
else feedback('warning', 'Please choose a nickname');
else Tools.feedback('warning', oChecker.desc);
}
function getInputs() {
var sNickname = $('#login').val();
var sUsername = sNickname.toLowerCase().replace(/\s+/g, '');
var sPass = $.trim($('#pass').val());
return {username: sUsername, nickname: sNickname, pass: sPass};
}
function getToken(asInputs) {
return md5(asInputs.username)+oMyThoughts.consts.token_sep+getLoginToken(asInputs.pass);
}
</script>

View File

@@ -1,11 +1,14 @@
<div id="feedback"></div>
<div id="header"></div>
<div id="menu">
<a href="#settings" class="button fa fa-gear"></a>
<ul>
<li><a href="#settings" class="button fal fa-settings"></a></li>
<li><a href="#logoff" class="button fal fa-logoff"></a></li>
</ul>
</div>
<div id="main"></div>
<div id="footer">
Designed and powered by Franzz &amp; Clarita.
My Thoughts Project under <a href="http://www.gnu.org/licenses/gpl.html" target="_blank">GPLv3</a> License.
</div>
<footer>
<span>Designed and powered by Franzz &amp; Clarita. </span>
<span>My Thoughts Project under <a href="http://www.gnu.org/licenses/gpl.html" target="_blank">GPLv3</a> License.</span>
</footer>
#errors#

View File

@@ -1,217 +1,217 @@
<div id="write">
<div id="write_feedback"></div>
<div id="nav">
<a class="fa fa-prev"></a>
<span class="page_nb">1</span>
<A class="fa fa-next"></a>
</div>
<div id="editor_container">
<div id="editor_content">
<div id="editor" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></div>
</div>
</div>
</div>
<script type="text/javascript">
oMyThoughts.pageInit = function(asHash, bFirstPage)
{
self.vars('id', 0);
self.vars('default_text', "\n");
self.vars('page', 0);
self.vars('keystrokes', 0);
//DOM
self.vars('editor', $('#editor_content'));
//Quill Engine
oQuill = new Quill('#editor', {
theme: 'bubble',
modules:
{
toolbar: [['bold', 'italic', 'underline'], [{ 'list': 'ordered'}, { 'list': 'bullet' }], ['clean']]
}
});
/*oQuill.setContents([
{insert: "So, I'm there, wondering about myself and my future - such a luxury by the way - when suddenly, someone approaches. mid-40s i'd say, elegant cold women, the kind you've learned not to talk to, to eventually avoid feeling repressed, or bad for yourself, or both."},
{insert: '\n'},
{insert: "Anyhow, it would seem that in this particular situation, the choice wasn't given to me to decide whether or not to talk to that precise women. She seats down next to me and engage a conversation. 'How is it you're here today?' I'm already regretting not having gone away when i still had the chance."},
{insert: '\n'},
{insert: "'Hello to you too' I say, still willing to show some manhood, even though I already know this women crushes manhood by pairs as a breakfast ritual."},
{insert: '\n'},
{insert: "In-extremist, I manage to babble some excuses about a rigorous lunch break time and leave the premises."},
{insert: '\n'},
{insert: "So, I'm there, wondering about myself and my future - such a luxury by the way - when suddenly, someone approaches. mid-40s i'd say, elegant cold women, the kind you've learned not to talk to, to eventually avoid feeling repressed, or bad for yourself, or both."},
{insert: '\n'},
{insert: "Anyhow, it would seem that in this particular situation, the choice wasn't given to me to decide whether or not to talk to that precise women. She seats down next to me and engage a conversation. 'How is it you're here today?' I'm already regretting not having gone away when i still had the chance."},
{insert: '\n'},
{insert: "'Hello to you too' I say, still willing to show some manhood, even though I already know this women crushes manhood by pairs as a breakfast ritual."},
{insert: '\n'},
{insert: "In-extremist, I manage to babble some excuses about a rigorous lunch break time and leave the premises."}
]);*/
setLastContent();
setPageHeight();
//Key strokes Events
$('#editor').keydown(function(e){
if($.inArray(e.which, [13, 37, 38, 39, 40]) != -1) onChange('', '', 'user', e);
});
oQuill.on('text-change', onChange);
//Page buttons
$('.fa-prev').click(function(){moveToPage(self.vars('page')-1);});
$('.fa-next').click(function(){moveToPage(self.vars('page')+1);});
//Init
oQuill.focus();
moveToPage(self.vars('page'));
};
oMyThoughts.onFeedback = function(sType, sMsg)
{
var $Feedback = $('#write_feedback');
$Feedback
.stop()
.fadeOut($Feedback.is(':empty')?0:'fast', function(){
$(this)
.empty()
.append($('<span>', {'class':sType}).text(sMsg))
.fadeIn('fast');
});
};
oMyThoughts.onQuitPage = function()
{
save();
return true;
};
function setPageHeight()
{
var $Page = $('#editor_container').css('height', 'calc(100% - 4em)');
var iHeight = $Page.height();
var iLineHeight = parseInt($('#editor_container p').css('line-height'));
var iMaxHeight = Math.floor(iHeight / iLineHeight) * iLineHeight;
$Page.height(iMaxHeight);
self.vars('line-height', iLineHeight);
self.vars('page_height', iMaxHeight);
}
function setLastContent(oQuill)
{
getInfo
(
'load',
function(sDesc, asData)
{
self.vars('id', asData.id);
oQuill.setContents(asData.ops);
},
{id: 'last'}
);
}
function onChange(delta, oldDelta, source, e)
{
if(source == 'user')
{
var range = oQuill.getSelection();
if(range)
{
var oSelBound = oQuill.getBounds(range.index, range.length);
var oEditorCurBound = { top: self.vars('page_height') * self.vars('page'),
bottom: self.vars('page_height') * (self.vars('page') + 1)};
//Anticipating arrows
if(e)
{
switch(e.which)
{
case 13: //Enter
break;
case 40: //down
oSelBound.bottom += self.vars('line-height');
break;
case 38: //up
oSelBound.top = Math.max(0, oSelBound.top - self.vars('line-height'));
break;
case 37: // left
oSelBound = oQuill.getBounds(Math.max(0, range.index - 1), range.length);
break;
case 39: // right
oSelBound = oQuill.getBounds(range.index + 1, range.length);
break;
}
}
else incKeyStrokes();
var sNewPage = self.vars('page');
if(oSelBound.top < oEditorCurBound.top)
{
sNewPage--;
}
else if(oSelBound.bottom > oEditorCurBound.bottom)
{
sNewPage++;
}
moveToPage(sNewPage);
}
}
}
function moveToPage(iNewPage)
{
if(iNewPage!=self.vars('page'))
{
var iOldPage = self.vars('page');
self.vars('page', iNewPage);
//Page Number
$('.page_nb').text(self.vars('page') + 1);
//Page Position
var iOffset = self.vars('page') * self.vars('page_height') * -1;
self.vars('editor').css('top', iOffset);
}
//Detect First Page
$('.fa-prev').fadeTo('fast', (self.vars('page')==0)?0:1);
//Detect last page
var bLastPage = (self.vars('editor').height() < self.vars('page_height') * (self.vars('page') + 1));
$('.fa-next').fadeTo('fast', bLastPage?0:1);
}
function incKeyStrokes()
{
self.vars('keystrokes', self.vars('keystrokes') + 1);
if(self.vars('keystrokes') % 20 == 0) save();
}
function save()
{
var sContent = oQuill.getContents().ops;
if(sContent[0] != self.vars('default_text'))
{
oMyThoughts.onFeedback('info', 'Saving...');
getInfo
(
'update',
function(sDesc, asData)
{
self.vars('id', asData.id);
oMyThoughts.onFeedback('notice', 'Saved ('+asData.led.substr(11, 5)+')');
},
{
id: self.vars('id'),
content: sContent
},
function(sError)
{
oMyThoughts.onFeedback('error', 'Not saved! An error occured: '+sError);
},
'POST'
);
}
}
<div id="write">
<div id="write_feedback"></div>
<div id="nav">
<a class="fal fa-prev"></a>
<span class="page_nb">1</span>
<A class="fal fa-next"></a>
</div>
<div id="editor_container">
<div id="editor_content">
<div id="editor" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"></div>
</div>
</div>
</div>
<script type="text/javascript">
oMyThoughts.pageInit = function(asHash, bFirstPage)
{
self.vars('id', 0);
self.vars('default_text', "\n");
self.vars('page', 0);
self.vars('keystrokes', 0);
//DOM
self.vars('editor', $('#editor_content'));
//Quill Engine
oQuill = new Quill('#editor', {
theme: 'bubble',
modules:
{
toolbar: [['bold', 'italic', 'underline'], [{ 'list': 'ordered'}, { 'list': 'bullet' }], ['clean']]
}
});
/*oQuill.setContents([
{insert: "So, I'm there, wondering about myself and my future - such a luxury by the way - when suddenly, someone approaches. mid-40s i'd say, elegant cold women, the kind you've learned not to talk to, to eventually avoid feeling repressed, or bad for yourself, or both."},
{insert: '\n'},
{insert: "Anyhow, it would seem that in this particular situation, the choice wasn't given to me to decide whether or not to talk to that precise women. She seats down next to me and engage a conversation. 'How is it you're here today?' I'm already regretting not having gone away when i still had the chance."},
{insert: '\n'},
{insert: "'Hello to you too' I say, still willing to show some manhood, even though I already know this women crushes manhood by pairs as a breakfast ritual."},
{insert: '\n'},
{insert: "In-extremist, I manage to babble some excuses about a rigorous lunch break time and leave the premises."},
{insert: '\n'},
{insert: "So, I'm there, wondering about myself and my future - such a luxury by the way - when suddenly, someone approaches. mid-40s i'd say, elegant cold women, the kind you've learned not to talk to, to eventually avoid feeling repressed, or bad for yourself, or both."},
{insert: '\n'},
{insert: "Anyhow, it would seem that in this particular situation, the choice wasn't given to me to decide whether or not to talk to that precise women. She seats down next to me and engage a conversation. 'How is it you're here today?' I'm already regretting not having gone away when i still had the chance."},
{insert: '\n'},
{insert: "'Hello to you too' I say, still willing to show some manhood, even though I already know this women crushes manhood by pairs as a breakfast ritual."},
{insert: '\n'},
{insert: "In-extremist, I manage to babble some excuses about a rigorous lunch break time and leave the premises."}
]);*/
setLastContent();
setPageHeight();
//Key strokes Events
$('#editor').keydown(function(e){
if($.inArray(e.which, [13, 37, 38, 39, 40]) != -1) onChange('', '', 'user', e);
});
oQuill.on('text-change', onChange);
//Page buttons
$('.fa-prev').click(function(){moveToPage(self.vars('page')-1);});
$('.fa-next').click(function(){moveToPage(self.vars('page')+1);});
//Init
oQuill.focus();
moveToPage(self.vars('page'));
};
oMyThoughts.onFeedback = function(sType, sMsg)
{
var $Feedback = $('#write_feedback');
$Feedback
.stop()
.fadeOut($Feedback.is(':empty')?0:'fast', function(){
$(this)
.empty()
.append($('<span>', {'class':sType}).text(sMsg))
.fadeIn('fast');
});
};
oMyThoughts.onQuitPage = function()
{
save();
return true;
};
function setPageHeight()
{
var $Page = $('#editor_container').css('height', 'calc(100% - 4em)');
var iHeight = $Page.height();
var iLineHeight = parseInt($('#editor_container p').css('line-height'));
var iMaxHeight = Math.floor(iHeight / iLineHeight) * iLineHeight;
$Page.height(iMaxHeight);
self.vars('line-height', iLineHeight);
self.vars('page_height', iMaxHeight);
}
function setLastContent(oQuill)
{
getInfo
(
'load',
function(sDesc, asData)
{
self.vars('id', asData.id);
oQuill.setContents(asData.ops);
},
{id: 'last'}
);
}
function onChange(delta, oldDelta, source, e)
{
if(source == 'user')
{
var range = oQuill.getSelection();
if(range)
{
var oSelBound = oQuill.getBounds(range.index, range.length);
var oEditorCurBound = { top: self.vars('page_height') * self.vars('page'),
bottom: self.vars('page_height') * (self.vars('page') + 1)};
//Anticipating arrows
if(e)
{
switch(e.which)
{
case 13: //Enter
break;
case 40: //down
oSelBound.bottom += self.vars('line-height');
break;
case 38: //up
oSelBound.top = Math.max(0, oSelBound.top - self.vars('line-height'));
break;
case 37: // left
oSelBound = oQuill.getBounds(Math.max(0, range.index - 1), range.length);
break;
case 39: // right
oSelBound = oQuill.getBounds(range.index + 1, range.length);
break;
}
}
else incKeyStrokes();
var sNewPage = self.vars('page');
if(oSelBound.top < oEditorCurBound.top)
{
sNewPage--;
}
else if(oSelBound.bottom > oEditorCurBound.bottom)
{
sNewPage++;
}
moveToPage(sNewPage);
}
}
}
function moveToPage(iNewPage)
{
if(iNewPage!=self.vars('page'))
{
var iOldPage = self.vars('page');
self.vars('page', iNewPage);
//Page Number
$('.page_nb').text(self.vars('page') + 1);
//Page Position
var iOffset = self.vars('page') * self.vars('page_height') * -1;
self.vars('editor').css('top', iOffset);
}
//Detect First Page
$('.fa-prev').fadeTo('fast', (self.vars('page')==0)?0:1);
//Detect last page
var bLastPage = (self.vars('editor').height() < self.vars('page_height') * (self.vars('page') + 1));
$('.fa-next').fadeTo('fast', bLastPage?0:1);
}
function incKeyStrokes()
{
self.vars('keystrokes', self.vars('keystrokes') + 1);
if(self.vars('keystrokes') % 20 == 0) save();
}
function save()
{
var sContent = oQuill.getContents().ops;
if(sContent[0] != self.vars('default_text'))
{
oMyThoughts.onFeedback('info', 'Saving...');
getInfo
(
'update',
function(sDesc, asData)
{
self.vars('id', asData.id);
oMyThoughts.onFeedback('notice', 'Saved ('+asData.led.substr(11, 5)+')');
},
{
id: self.vars('id'),
content: sContent
},
function(sError)
{
oMyThoughts.onFeedback('error', 'Not saved! An error occured: '+sError);
},
'POST'
);
}
}
</script>