adding read page and side calendar
This commit is contained in:
@@ -74,6 +74,12 @@ var Tools = {
|
||||
.slideDown('fast')
|
||||
.delay(5000)
|
||||
.slideUp('fast', function(){$(this).remove();});
|
||||
},
|
||||
|
||||
quill2Html: function(asDelta) {
|
||||
var tempCont = document.createElement("div");
|
||||
(new Quill(tempCont)).setContents(asDelta);
|
||||
return tempCont.getElementsByClassName("ql-editor")[0].innerHTML;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -56,6 +56,34 @@ function MyThoughts(asGlobals)
|
||||
this.initMenu = function()
|
||||
{
|
||||
self.elem.$Menu.show('fast');
|
||||
|
||||
//Thoughts on side menu
|
||||
self.updateSideMenu();
|
||||
};
|
||||
|
||||
this.updateSideMenu = function() {
|
||||
Tools.ajax(
|
||||
'thoughts',
|
||||
function(asData){
|
||||
self.elem.$Side.find('.tag:not(.write)').remove();
|
||||
$.each(asData, function(iKey, asThought) {
|
||||
$Tile = $('<div>', {'class': 'tag'}).appendTo(self.elem.$Side);
|
||||
var $Link = $('<a>', {'href': '#read-'+asThought.id_thought}).html(asThought.created_f.replace(' ', '<br />')).appendTo($Tile);
|
||||
});
|
||||
self.elem.$Side.slideDown('fast', self.setSideElemVisibility);
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
this.setSideElemVisibility = function() {
|
||||
if(self.elem.$Side) {
|
||||
var iHeight = 0;
|
||||
var iMaxHeight = self.elem.$Side.height();
|
||||
self.elem.$Side.children().each(function(){
|
||||
$(this).toggle(iMaxHeight - iHeight > 0);
|
||||
iHeight += $(this).outerHeight(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
/* Events */
|
||||
@@ -63,6 +91,7 @@ function MyThoughts(asGlobals)
|
||||
this.onResize = function()
|
||||
{
|
||||
self.vars('mobile', $('body').css('min-width')=='120px');
|
||||
self.setSideElemVisibility();
|
||||
//self.scrollbar();
|
||||
};
|
||||
|
||||
@@ -77,7 +106,7 @@ function MyThoughts(asGlobals)
|
||||
self.pageInit = function(asHash, bFirstPage){console.log('no init for the page: '+asHash.page)};
|
||||
self.onSamePageMove = function(asHash){return false};
|
||||
self.onQuitPage = function(){return true};
|
||||
self.onFeedback = function(sType, sMsg){Tools.feedback(sType, sMsg, self.elem.$Container);};
|
||||
self.onFeedback = function(sType, sMsg){Tools.feedback(sType, sMsg);};
|
||||
};
|
||||
|
||||
this.feedback = function(sType, sMsg) {
|
||||
@@ -174,7 +203,7 @@ function MyThoughts(asGlobals)
|
||||
}
|
||||
else
|
||||
{
|
||||
var bSamePage = (sCurrPage==sNextPage);
|
||||
var bSamePage = (sCurrPage == sNextPage);
|
||||
if(self.onQuitPage(bSamePage) && !bSamePage || self.onSamePageMove(asHash))
|
||||
{
|
||||
//Delete tmp variables
|
||||
@@ -184,7 +213,7 @@ function MyThoughts(asGlobals)
|
||||
self.resetTmpFunctions();
|
||||
|
||||
//Officially a new page
|
||||
var bFirstPage = (sCurrPage=='');
|
||||
var bFirstPage = (sCurrPage == '');
|
||||
self.vars('page', sNextPage);
|
||||
|
||||
//Update Page Title
|
||||
@@ -199,6 +228,7 @@ function MyThoughts(asGlobals)
|
||||
self.elem.$Main = self.elem.$Container.find('#main');
|
||||
|
||||
self.elem.$Menu = self.elem.$Container.find('#menu');
|
||||
self.elem.$Side = self.elem.$Container.find('#side');
|
||||
if(self.vars.log_in) self.initMenu();
|
||||
|
||||
self.splash(self.elem.$Main, $Dom, asHash, bFirstPage); //first page
|
||||
|
||||
Reference in New Issue
Block a user