@ -27452,7 +27452,192 @@ function () {
var _default = DateUtils ;
var _default = DateUtils ;
exports . default = _default ;
exports . default = _default ;
} , { } ] , "../../../../node_modules/markdown-it/lib/common/entities.js" : [ function ( require , module , exports ) {
} , { } ] , "../../../../brain/tools/utilities/DBUtils.js" : [ function ( require , module , exports ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
exports . default = exports . FINAL _KEY = exports . COUNT = void 0 ;
var _DataUtils = _interopRequireWildcard ( require ( "../utilities/DataUtils" ) ) ;
var _dexie = _interopRequireDefault ( require ( "dexie" ) ) ;
var DataEvent = _interopRequireWildcard ( require ( "../events/DataEvent" ) ) ;
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
function _interopRequireWildcard ( obj ) { if ( obj && obj . _ _esModule ) { return obj ; } else { var newObj = { } ; if ( obj != null ) { for ( var key in obj ) { if ( Object . prototype . hasOwnProperty . call ( obj , key ) ) { var desc = Object . defineProperty && Object . getOwnPropertyDescriptor ? Object . getOwnPropertyDescriptor ( obj , key ) : { } ; if ( desc . get || desc . set ) { Object . defineProperty ( newObj , key , desc ) ; } else { newObj [ key ] = obj [ key ] ; } } } } newObj . default = obj ; return newObj ; } }
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
function _defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } }
function _createClass ( Constructor , protoProps , staticProps ) { if ( protoProps ) _defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) _defineProperties ( Constructor , staticProps ) ; return Constructor ; }
var COUNT ;
exports . COUNT = COUNT ;
var FINAL _KEY ;
exports . FINAL _KEY = FINAL _KEY ;
var DBUtils =
/*#__PURE__*/
function ( ) {
//--------------------------
// constructor
//--------------------------
function DBUtils ( ) {
_classCallCheck ( this , DBUtils ) ;
this . dataUtils = new _DataUtils . default ( ) ;
this . db = new _dexie . default ( "fipamo_posts" ) ;
this . db . version ( 1 ) . stores ( {
postList : 'id,post'
} ) ;
this . db . postList . toArray ( function ( array ) {
exports . COUNT = COUNT = array . length ;
exports . FINAL _KEY = FINAL _KEY = array [ COUNT - 1 ] . id ;
} ) ;
} //--------------------------
// methods
//--------------------------
_createClass ( DBUtils , [ {
key : "modify" ,
value : function modify ( id , postData ) {
var self = this ;
var freshID ;
return new Promise ( function ( resolve , reject ) {
if ( id == null ) {
self . db . postList . put ( postData ) . then ( function ( fresh ) {
freshID = fresh ;
} ) . catch ( function ( e ) {
var err = {
message : "PUT ERROR" ,
error : e
} ;
} ) ;
} else {
self . db . postList . update ( Number ( id ) , {
post : postData
} ) . then ( function ( updated ) { } ) . catch ( function ( e ) {
consol . log ( "ERROR" , e ) ;
var err = {
message : "UPDATE ERROR" ,
error : e
} ;
} ) ;
}
self . db . postList . toArray ( function ( array ) {
self . syncRemote ( array , freshID ) . then ( function ( response ) {
resolve ( {
response : response
} ) ;
} ) . catch ( function ( err ) {
reject ( {
err : err
} ) ;
} ) ;
} ) ;
} ) ;
}
} , {
key : "syncLocal" ,
value : function syncLocal ( array ) {
var self = this ;
return new Promise ( function ( resolve , reject ) {
self . db . postList . clear ( ) . then ( function ( result ) {
self . db . postList . bulkAdd ( array ) . then ( function ( key ) {
self . db . postList . toArray ( function ( array ) {
var event = DataEvent . LOCAL _DB _READY ;
resolve ( {
event : event
} ) ;
} ) ;
} ) . catch ( _dexie . default . BulkError , function ( e ) {
reject ( {
e : e
} ) ;
} ) ;
} ) ;
} ) ;
}
} , {
key : "syncRemote" ,
value : function syncRemote ( db , newPostId ) {
var self = this ;
return new Promise ( function ( resolve , reject ) {
self . dataUtils . request ( '/api/post/sync' , DataEvent . POSTS _SYNCED , _DataUtils . REQUEST _TYPE _POST , _DataUtils . CONTENT _TYPE _JSON , db ) . then ( function ( response ) {
var bounce = {
message : response ,
newPost : newPostId
} ;
resolve ( bounce ) ;
} ) . catch ( function ( err ) {
reject ( err ) ;
} ) ;
} ) ;
}
} , {
key : "getPost" ,
value : function getPost ( id ) {
var self = this ;
if ( id == null ) {
return new Promise ( function ( resolve , reject ) {
self . db . postList . toArray ( function ( array ) {
resolve ( array ) ;
} ) . catch ( function ( err ) {
reject ( err ) ;
} ) ;
} ) ;
} else {
return new Promise ( function ( resolve , reject ) {
self . db . postList . get ( Number ( id ) ) . then ( function ( obj ) {
resolve ( obj ) ;
} ) . catch ( function ( err ) {
reject ( err ) ;
} ) ;
} ) ;
}
}
} , {
key : "archivePost" ,
value : function archivePost ( id , archive ) {
var self = this ;
return new Promise ( function ( resolve , reject ) {
self . db . postList . update ( Number ( id ) , {
post : archive
} ) . then ( function ( deleted ) {
self . db . postList . toArray ( function ( array ) {
self . syncRemote ( array , null ) . then ( function ( response ) {
resolve ( {
response : response
} ) ;
} ) . catch ( function ( err ) {
reject ( {
err : err
} ) ;
} ) ;
} ) ;
} ) . catch ( function ( e ) {
console . log ( "ERROR" , e ) ;
} ) ;
} ) ;
} //--------------------------
// event handlers
//--------------------------
} ] ) ;
return DBUtils ;
} ( ) ;
exports . default = DBUtils ;
} , { "../utilities/DataUtils" : "../../../../brain/tools/utilities/DataUtils.js" , "dexie" : "../../../../node_modules/dexie/dist/dexie.es.js" , "../events/DataEvent" : "../../../../brain/tools/events/DataEvent.js" } ] , "../../../../node_modules/markdown-it/lib/common/entities.js" : [ function ( require , module , exports ) {
// HTML5 entities map: { name -> utf16string }
// HTML5 entities map: { name -> utf16string }
//
//
'use strict' ;
'use strict' ;
@ -34989,6 +35174,8 @@ var _sanitizeHtml = _interopRequireDefault(require("sanitize-html"));
var _DateUtils = _interopRequireDefault ( require ( "../../../../../brain/tools/utilities/DateUtils" ) ) ;
var _DateUtils = _interopRequireDefault ( require ( "../../../../../brain/tools/utilities/DateUtils" ) ) ;
var _DBUtils = _interopRequireDefault ( require ( "../../../../../brain/tools/utilities/DBUtils" ) ) ;
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
function _interopRequireWildcard ( obj ) { if ( obj && obj . _ _esModule ) { return obj ; } else { var newObj = { } ; if ( obj != null ) { for ( var key in obj ) { if ( Object . prototype . hasOwnProperty . call ( obj , key ) ) { var desc = Object . defineProperty && Object . getOwnPropertyDescriptor ? Object . getOwnPropertyDescriptor ( obj , key ) : { } ; if ( desc . get || desc . set ) { Object . defineProperty ( newObj , key , desc ) ; } else { newObj [ key ] = obj [ key ] ; } } } } newObj . default = obj ; return newObj ; } }
function _interopRequireWildcard ( obj ) { if ( obj && obj . _ _esModule ) { return obj ; } else { var newObj = { } ; if ( obj != null ) { for ( var key in obj ) { if ( Object . prototype . hasOwnProperty . call ( obj , key ) ) { var desc = Object . defineProperty && Object . getOwnPropertyDescriptor ? Object . getOwnPropertyDescriptor ( obj , key ) : { } ; if ( desc . get || desc . set ) { Object . defineProperty ( newObj , key , desc ) ; } else { newObj [ key ] = obj [ key ] ; } } } } newObj . default = obj ; return newObj ; } }
@ -35014,10 +35201,7 @@ function () {
this . dataUtils = new _DataUtils . default ( ) ;
this . dataUtils = new _DataUtils . default ( ) ;
this . dateUtils = new _DateUtils . default ( ) ;
this . dateUtils = new _DateUtils . default ( ) ;
this . db = new _dexie . default ( "fipamo_posts" ) ;
this . dbUtils = new _DBUtils . default ( ) ;
this . db . version ( 1 ) . stores ( {
postList : 'id,post'
} ) ;
} //--------------------------
} //--------------------------
// methods
// methods
//--------------------------
//--------------------------
@ -35027,7 +35211,7 @@ function () {
key : "update" ,
key : "update" ,
value : function update ( id , data , files , lastKey ) {
value : function update ( id , data , files , lastKey ) {
var self = this ;
var self = this ;
var newID = null ;
var freshData ;
return new Promise ( function ( resolve , reject ) {
return new Promise ( function ( resolve , reject ) {
var txt = document . createElement ( "textarea" ) ;
var txt = document . createElement ( "textarea" ) ;
txt . innerHTML = document . getElementById ( 'edit-post-text' ) . innerHTML ;
txt . innerHTML = document . getElementById ( 'edit-post-text' ) . innerHTML ;
@ -35066,11 +35250,12 @@ function () {
data . feature = "/content/blog-images/" + self . dateUtils . getDate ( 'year' , new Date ( ) ) + "/" + self . dateUtils . getDate ( 'month' , new Date ( ) ) + "/" + file . name ;
data . feature = "/content/blog-images/" + self . dateUtils . getDate ( 'year' , new Date ( ) ) + "/" + self . dateUtils . getDate ( 'month' , new Date ( ) ) + "/" + file . name ;
}
}
} else { //data.feature = "";
} else {
if ( typeof data . feature == 'undefined' ) data . feature = "" ;
}
}
if ( id == null ) {
if ( id == null ) {
self. db . postList . put ( {
freshData = {
id : lastKey + 1 ,
id : lastKey + 1 ,
post : {
post : {
uuid : uuidv4 ( ) ,
uuid : uuidv4 ( ) ,
@ -35084,63 +35269,33 @@ function () {
page : data . page ,
page : data . page ,
featured : data . featured ,
featured : data . featured ,
published : data . published ,
published : data . published ,
deleted : "" ,
author : "user"
author : "user"
}
}
} ) . then ( function ( fresh ) {
} ;
newID = fresh ;
} ) ;
} else {
} else {
self . db . postList . update ( Number ( id ) , {
freshData = data ;
post : data
} ) . then ( function ( updated ) { } ) ;
}
}
self . db . postList . toArray ( function ( array ) {
self . dbUtils . modify ( id , freshData ) . then ( function ( response ) {
self . sync ( array , newID ) . then ( function ( response ) {
resolve ( response ) ;
resolve ( {
response : response
} ) ;
} ) . catch ( function ( err ) {
reject ( {
err : err
} ) ;
} ) ;
} ) ;
} ) ;
}
} , {
key : "sync" ,
value : function sync ( db , newPostId ) {
var self = this ;
return new Promise ( function ( resolve , reject ) {
self . dataUtils . request ( '/api/post/sync' , DataEvent . POSTS _SYNCED , _DataUtils . REQUEST _TYPE _POST , _DataUtils . CONTENT _TYPE _JSON , db ) . then ( function ( response ) {
var bounce = {
message : response ,
newPost : newPostId
} ;
resolve ( {
bounce : bounce
} ) ;
} ) . catch ( function ( err ) {
} ) . catch ( function ( err ) {
reject ( {
reject ( err ) ;
err : err
} ) ;
} ) ;
} ) ;
} ) ;
} ) ;
}
}
} , {
} , {
key : "deletePost" ,
key : "deletePost" ,
value : function deletePost ( ) {
value : function deletePost ( id , body ) {
var self = this ;
var self = this ;
body . deleted = new Date ( ) . toString ( ) ;
return new Promise ( function ( resolve , reject ) {
return new Promise ( function ( resolve , reject ) {
self . dataUtils . request ( "/api/post/delete/" + postID , DataEvent . POST _DELETED , _DataUtils . REQUEST _TYPE _POST , _DataUtils . CONTENT _TYPE _FORM ) . then ( function ( response ) {
self . dbUtils . archivePost ( id , body ) . then ( function ( response ) {
resolve ( {
console . log ( response ) ;
response : response
resolve ( response ) ;
} ) ;
} ) . catch ( function ( err ) {
} ) . catch ( function ( err ) {
reject ( {
console . log ( err ) ;
err : err
reject ( error ) ;
} ) ;
} ) ;
} ) ;
} ) ;
} ) ;
} //--------------------------
} //--------------------------
@ -35153,7 +35308,7 @@ function () {
} ( ) ;
} ( ) ;
exports . default = PostActions ;
exports . default = PostActions ;
} , { "../../../../../brain//tools/utilities/DataUtils" : "../../../../brain/tools/utilities/DataUtils.js" , "../../../../../brain//tools/events/DataEvent" : "../../../../brain/tools/events/DataEvent.js" , "../../../../../brain//tools/utilities/StringUtils" : "../../../../brain/tools/utilities/StringUtils.js" , "dexie" : "../../../../node_modules/dexie/dist/dexie.es.js" , "sanitize-html" : "../../../../node_modules/sanitize-html/dist/index.js" , "../../../../../brain/tools/utilities/DateUtils" : "../../../../brain/tools/utilities/DateUtils.js" , " markdown-it": "../../../../node_modules/markdown-it/index.js" , "uuid/v4" : "../../../../node_modules/uuid/v4.js" } ] , "../../../../brain/tools/events/EditorEvent.js" : [ function ( require , module , exports ) {
} , { "../../../../../brain//tools/utilities/DataUtils" : "../../../../brain/tools/utilities/DataUtils.js" , "../../../../../brain//tools/events/DataEvent" : "../../../../brain/tools/events/DataEvent.js" , "../../../../../brain//tools/utilities/StringUtils" : "../../../../brain/tools/utilities/StringUtils.js" , "dexie" : "../../../../node_modules/dexie/dist/dexie.es.js" , "sanitize-html" : "../../../../node_modules/sanitize-html/dist/index.js" , "../../../../../brain/tools/utilities/DateUtils" : "../../../../brain/tools/utilities/DateUtils.js" , " ../../../../../brain/tools/utilities/DBUtils": "../../../../brain/tools/utilities/DBUtils.js" , " markdown-it": "../../../../node_modules/markdown-it/index.js" , "uuid/v4" : "../../../../node_modules/uuid/v4.js" } ] , "../../../../brain/tools/events/EditorEvent.js" : [ function ( require , module , exports ) {
"use strict" ;
"use strict" ;
Object . defineProperty ( exports , "__esModule" , {
Object . defineProperty ( exports , "__esModule" , {
@ -37141,6 +37296,8 @@ var _TextEditor = _interopRequireDefault(require("../../../../../brain/tools/ui/
var _dexie = _interopRequireDefault ( require ( "dexie" ) ) ;
var _dexie = _interopRequireDefault ( require ( "dexie" ) ) ;
var _DBUtils = _interopRequireWildcard ( require ( "../../../../../brain/tools/utilities/DBUtils" ) ) ;
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
function _interopRequireWildcard ( obj ) { if ( obj && obj . _ _esModule ) { return obj ; } else { var newObj = { } ; if ( obj != null ) { for ( var key in obj ) { if ( Object . prototype . hasOwnProperty . call ( obj , key ) ) { var desc = Object . defineProperty && Object . getOwnPropertyDescriptor ? Object . getOwnPropertyDescriptor ( obj , key ) : { } ; if ( desc . get || desc . set ) { Object . defineProperty ( newObj , key , desc ) ; } else { newObj [ key ] = obj [ key ] ; } } } } newObj . default = obj ; return newObj ; } }
function _interopRequireWildcard ( obj ) { if ( obj && obj . _ _esModule ) { return obj ; } else { var newObj = { } ; if ( obj != null ) { for ( var key in obj ) { if ( Object . prototype . hasOwnProperty . call ( obj , key ) ) { var desc = Object . defineProperty && Object . getOwnPropertyDescriptor ? Object . getOwnPropertyDescriptor ( obj , key ) : { } ; if ( desc . get || desc . set ) { Object . defineProperty ( newObj , key , desc ) ; } else { newObj [ key ] = obj [ key ] ; } } } } newObj . default = obj ; return newObj ; } }
@ -37167,21 +37324,21 @@ function () {
this . dataUtils = new _DataUtils . default ( ) ;
this . dataUtils = new _DataUtils . default ( ) ;
this . dateUtils = new _DateUtils . default ( ) ;
this . dateUtils = new _DateUtils . default ( ) ;
this . urlPieces = document . URL . split ( "/" ) ;
this . urlPieces = document . URL . split ( "/" ) ;
this . dbUtils = new _DBUtils . default ( ) ;
this . post = [ ] ;
this . post = [ ] ;
this . postID = null ;
this . postID = null ;
this . postCount = null ;
this . postFinalKey = null ;
if ( document . getElementById ( 'post-edit-index' ) . getAttribute ( 'data-index' ) ) {
if ( document . getElementById ( 'post-edit-index' ) . getAttribute ( 'data-index' ) ) this . postID = document . getElementById ( 'post-edit-index' ) . getAttribute ( 'data-index' ) ;
this . postID = document . getElementById ( 'post-edit-index' ) . getAttribute ( 'data-index' ) ;
var fipamoPosts = new _dexie . default ( "fipamo_posts" ) ;
this . dbUtils . getPost ( this . postID ) . then ( function ( body ) {
fipamoPosts . version ( 1 ) . stores ( {
self . post = body . post ;
postList : 'id, post'
} ) ;
_this . start ( ) ;
fipamoPosts . postList . toArray ( function ( array ) {
} ) . catch ( function ( err ) { //console.log(err)
self . setListVars ( array ) ;
} ) ;
} ) ;
if ( this . postID != null ) fipamoPosts . postList . get ( Number ( this . postID ) ) . then ( function ( obj ) {
} else {
return _this . setPost ( obj . post ) ;
this. start ( ) ;
} ) ; else this . start ( ) ;
}
if ( document . getElementById ( 'edit-post-text' ) ) {
if ( document . getElementById ( 'edit-post-text' ) ) {
this . editor = new _TextEditor . default ( document . getElementById ( 'edit-post-text' ) , document . getElementById ( 'header' ) . offsetHeight + document . getElementById ( 'post-header' ) . offsetHeight + document . getElementById ( 'post-feature' ) . offsetHeight ) ;
this . editor = new _TextEditor . default ( document . getElementById ( 'edit-post-text' ) , document . getElementById ( 'header' ) . offsetHeight + document . getElementById ( 'post-header' ) . offsetHeight + document . getElementById ( 'post-feature' ) . offsetHeight ) ;
@ -37214,18 +37371,6 @@ function () {
_createClass ( PostEditor , [ {
_createClass ( PostEditor , [ {
key : "setPost" ,
value : function setPost ( array ) {
this . post = array ;
this . start ( ) ;
}
} , {
key : "setListVars" ,
value : function setListVars ( array ) {
this . postCount = array . length ;
this . postFinalKey = array [ this . postCount - 1 ] . id ;
}
} , {
key : "start" ,
key : "start" ,
value : function start ( ) {
value : function start ( ) {
var _this2 = this ;
var _this2 = this ;
@ -37287,37 +37432,33 @@ function () {
value : function handleEditorOptions ( e ) {
value : function handleEditorOptions ( e ) {
var _this3 = this ;
var _this3 = this ;
var self = this ;
switch ( e ) {
switch ( e ) {
case EditorEvent . EDITOR _SAVE :
case EditorEvent . EDITOR _SAVE :
new _PostActions . default ( ) . update ( this . postID , this . post , PostEditor . uploadFiles , this . postFinalKey ) . then ( function ( response ) {
new _PostActions . default ( ) . update ( this . postID , this . post , PostEditor . uploadFiles , _DBUtils . FINAL _KEY ) . then ( function ( response ) {
var freshDB = new _dexie . default ( "fipamo_posts" ) ;
freshDB . version ( 1 ) . stores ( {
postList : 'id, post'
} ) ;
setTimeout ( function ( f ) {
setTimeout ( function ( f ) {
freshDB. postList . ge t( Number ( response . response . bounce. newPost) ) . then ( function ( obj ) {
self . dbUtils . getPost ( Number ( response . response . newPost ) ) . then ( function ( r ) {
window . location = "/@/dashboard/posts/edit/" + obj . post . slug ;
window . location = "/@/dashboard/posts/edit/" + r . post . slug ;
} ) ;
} ) ;
} , 200 ) ;
} , 100 ) ;
} ) . catch ( function ( err ) {
} ) . catch ( function ( err ) { //console.log("ERROR", err)
console . log ( "ERROR" , err ) ;
} ) ;
} ) ;
break ;
break ;
case EditorEvent . EDITOR _UPDATE :
case EditorEvent . EDITOR _UPDATE :
new _PostActions . default ( ) . update ( this . postID , this . post , PostEditor . uploadFiles , this . postFinalKey ) . then ( function ( response ) {
new _PostActions . default ( ) . update ( this . postID , this . post , PostEditor . uploadFiles , _DBUtils . FINAL _KEY ) . then ( function ( response ) {
//console.log(response.response.bounce.newPost);
_this3 . editor . notify ( DataEvent . POST _UPDATED , _this3 . postID ) ;
_this3 . editor . notify ( DataEvent . POST _UPDATED , _this3 . postID ) ;
} ) . catch ( function ( err ) {
} ) . catch ( function ( err ) { //console.log("ERRORZ", err)
console . log ( "ERROR" , err ) ;
} ) ;
} ) ;
break ;
break ;
case EditorEvent . EDITOR _DELETE :
case EditorEvent . EDITOR _DELETE :
if ( confirm ( 'Aye! You know you\'re deleting this post, right?' ) ) {
if ( confirm ( 'Aye! You know you\'re deleting this post, right?' ) ) {
new _PostActions . default ( ) . deletePost ( ) . then ( function ( response ) {
new _PostActions . default ( ) . deletePost ( this . postID , this . post ) . then ( function ( response ) {
var note = JSON . parse ( response [ 'response' ] [ 'request' ] . response ) ;
setTimeout ( function ( f ) {
window . location = "/@/dashboard/posts/" ;
window . location = "/@/dashboard/posts/" ;
} , 100 ) ;
} ) . catch ( function ( err ) {
} ) . catch ( function ( err ) {
console . log ( err ) ;
console . log ( err ) ;
} ) ;
} ) ;
@ -37401,8 +37542,7 @@ function () {
this . dataUtils . request ( url , eventType , _DataUtils . REQUEST _TYPE _POST , _DataUtils . CONTENT _TYPE _FORM , imageData ) . then ( function ( response ) {
this . dataUtils . request ( url , eventType , _DataUtils . REQUEST _TYPE _POST , _DataUtils . CONTENT _TYPE _FORM , imageData ) . then ( function ( response ) {
var r = JSON . parse ( response . request [ 'response' ] ) ;
var r = JSON . parse ( response . request [ 'response' ] ) ;
if ( r . message == DataEvent . POST _IMAGE _ADDED ) self . editor . notify ( EditorEvent . EDITOR _UPLOAD _POST _IMAGE , r . url ) ;
if ( r . message == DataEvent . POST _IMAGE _ADDED ) self . editor . notify ( EditorEvent . EDITOR _UPLOAD _POST _IMAGE , r . url ) ;
} ) . catch ( function ( err ) {
} ) . catch ( function ( err ) { //console.log(err)
console . log ( err ) ;
} ) ;
} ) ;
}
}
} ] ) ;
} ] ) ;
@ -37412,7 +37552,7 @@ function () {
exports . default = PostEditor ;
exports . default = PostEditor ;
PostEditor . uploadFiles = [ ] ;
PostEditor . uploadFiles = [ ] ;
} , { "../../../../../brain/tools/utilities/DataUtils" : "../../../../brain/tools/utilities/DataUtils.js" , "../../../../../brain/tools/events/DataEvent" : "../../../../brain/tools/events/DataEvent.js" , "../../../../../brain/tools/effects/Animate" : "../../../../brain/tools/effects/Animate.js" , "../actions/PostActions" : "actions/PostActions.js" , "../../../../../brain/tools/events/EditorEvent" : "../../../../brain/tools/events/EditorEvent.js" , "tiny-date-picker" : "../../../../node_modules/tiny-date-picker/dist/tiny-date-picker.js" , "../../../../../brain/tools/utilities/DateUtils" : "../../../../brain/tools/utilities/DateUtils.js" , "../../../../../brain/tools/ui/TextEditor" : "../../../../brain/tools/ui/TextEditor.js" , "dexie" : "../../../../node_modules/dexie/dist/dexie.es.js" }] , "controllers/PostIndex.js" : [ function ( require , module , exports ) {
} , { "../../../../../brain/tools/utilities/DataUtils" : "../../../../brain/tools/utilities/DataUtils.js" , "../../../../../brain/tools/events/DataEvent" : "../../../../brain/tools/events/DataEvent.js" , "../../../../../brain/tools/effects/Animate" : "../../../../brain/tools/effects/Animate.js" , "../actions/PostActions" : "actions/PostActions.js" , "../../../../../brain/tools/events/EditorEvent" : "../../../../brain/tools/events/EditorEvent.js" , "tiny-date-picker" : "../../../../node_modules/tiny-date-picker/dist/tiny-date-picker.js" , "../../../../../brain/tools/utilities/DateUtils" : "../../../../brain/tools/utilities/DateUtils.js" , "../../../../../brain/tools/ui/TextEditor" : "../../../../brain/tools/ui/TextEditor.js" , "dexie" : "../../../../node_modules/dexie/dist/dexie.es.js" ,"../../../../../brain/tools/utilities/DBUtils" : "../../../../brain/tools/utilities/DBUtils.js" }] , "controllers/PostIndex.js" : [ function ( require , module , exports ) {
"use strict" ;
"use strict" ;
Object . defineProperty ( exports , "__esModule" , {
Object . defineProperty ( exports , "__esModule" , {
@ -37549,396 +37689,7 @@ function () {
} ( ) ;
} ( ) ;
exports . default = DashManager ;
exports . default = DashManager ;
} , { "./PostEditor" : "controllers/PostEditor.js" , "../../../../../brain/tools/effects/Animate" : "../../../../brain/tools/effects/Animate.js" , "./PostIndex" : "controllers/PostIndex.js" } ] , "../../../default/src/com/tools/events/EventEmitter.jsx" : [ function ( require , module , exports ) {
} , { "./PostEditor" : "controllers/PostEditor.js" , "../../../../../brain/tools/effects/Animate" : "../../../../brain/tools/effects/Animate.js" , "./PostIndex" : "controllers/PostIndex.js" } ] , "Base.js" : [ function ( require , module , exports ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
exports . default = void 0 ;
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
function _defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } }
function _createClass ( Constructor , protoProps , staticProps ) { if ( protoProps ) _defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) _defineProperties ( Constructor , staticProps ) ; return Constructor ; }
var EventEmitter =
/*#__PURE__*/
function ( ) {
//--------------------------
// constructor
//--------------------------
function EventEmitter ( ) {
_classCallCheck ( this , EventEmitter ) ;
this . listeners = new Map ( ) ;
} //--------------------------
// methods
//--------------------------
_createClass ( EventEmitter , [ {
key : "addListener" ,
value : function addListener ( label , callback ) {
this . listeners . has ( label ) || this . listeners . set ( label , [ ] ) ;
this . listeners . get ( label ) . push ( callback ) ;
}
} , {
key : "removeListener" ,
value : function removeListener ( label , callback ) {
var isFunction = function isFunction ( obj ) {
return typeof obj == 'function' || false ;
} ;
var listeners = this . listeners . get ( label ) ,
index ;
if ( listeners && listeners . length ) {
index = listeners . reduce ( function ( i , listener , index ) {
return isFunction ( listener ) && listener === callback ? i = index : i ;
} , - 1 ) ;
if ( index > - 1 ) {
listeners . splice ( index , 1 ) ;
this . listeners . set ( label , listeners ) ;
return true ;
}
}
return false ;
}
} , {
key : "emitEvent" ,
value : function emitEvent ( label ) {
for ( var _len = arguments . length , args = new Array ( _len > 1 ? _len - 1 : 0 ) , _key = 1 ; _key < _len ; _key ++ ) {
args [ _key - 1 ] = arguments [ _key ] ;
}
var listeners = this . listeners . get ( label ) ;
if ( listeners && listeners . length ) {
listeners . forEach ( function ( listener ) {
listener . apply ( void 0 , args ) ;
} ) ;
return true ;
}
return false ;
} //--------------------------
// event handlers
//--------------------------
} ] ) ;
return EventEmitter ;
} ( ) ;
var _default = EventEmitter ;
exports . default = _default ;
} , { } ] , "../../../default/src/com/tools/events/DataEvent.jsx" : [ function ( require , module , exports ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
exports . default = exports . PROJECTS _SORTED = exports . PROJECT _ADDED = exports . PROJECT _UPDATED = exports . ARCHIVES _ENTRY _LOADED = exports . ARCHIVES _PAGE _LOADED = exports . ARCHIVES _JSON _LOADED = exports . HTML _LOADED = exports . SETTINGS _LOADED = exports . IMG _REQUEST _LAME = exports . IMG _REQUEST _GOOD = exports . REQUEST _LAME = exports . REQUEST _GOOD = void 0 ;
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
var REQUEST _GOOD = 'requestGood' ;
exports . REQUEST _GOOD = REQUEST _GOOD ;
var REQUEST _LAME = 'requestLame' ;
exports . REQUEST _LAME = REQUEST _LAME ;
var IMG _REQUEST _GOOD = 'imgRequestGood' ;
exports . IMG _REQUEST _GOOD = IMG _REQUEST _GOOD ;
var IMG _REQUEST _LAME = 'imgRequestLame' ;
exports . IMG _REQUEST _LAME = IMG _REQUEST _LAME ;
var SETTINGS _LOADED = 'dataLoaded' ;
exports . SETTINGS _LOADED = SETTINGS _LOADED ;
var HTML _LOADED = 'htmlLoaded' ;
exports . HTML _LOADED = HTML _LOADED ;
var ARCHIVES _JSON _LOADED = 'archivesJSONLoaded' ;
exports . ARCHIVES _JSON _LOADED = ARCHIVES _JSON _LOADED ;
var ARCHIVES _PAGE _LOADED = 'archivesPAGELoaded' ;
exports . ARCHIVES _PAGE _LOADED = ARCHIVES _PAGE _LOADED ;
var ARCHIVES _ENTRY _LOADED = 'archivesEntryLoaded' ;
exports . ARCHIVES _ENTRY _LOADED = ARCHIVES _ENTRY _LOADED ;
var PROJECT _UPDATED = 'projectUpdated' ;
exports . PROJECT _UPDATED = PROJECT _UPDATED ;
var PROJECT _ADDED = 'projectAdded' ;
exports . PROJECT _ADDED = PROJECT _ADDED ;
var PROJECTS _SORTED = 'projectsSorted' ;
exports . PROJECTS _SORTED = PROJECTS _SORTED ;
var DataEvent = function DataEvent ( ) {
_classCallCheck ( this , DataEvent ) ;
} ;
var _default = new DataEvent ( ) ;
exports . default = _default ;
} , { } ] , "../../../default/src/com/tools/utilities/DataUtils.jsx" : [ function ( require , module , exports ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
exports . default = exports . CONTENT _TYPE _FORM = exports . CONTENT _TYPE _JSON = exports . REQUEST _TYPE _DELETE = exports . REQUEST _TYPE _PUT = exports . REQUEST _TYPE _GET = exports . REQUEST _TYPE _POST = void 0 ;
var _EventEmitter2 = _interopRequireDefault ( require ( "../events/EventEmitter.jsx" ) ) ;
var DataEvent = _interopRequireWildcard ( require ( "../events/DataEvent.jsx" ) ) ;
function _interopRequireWildcard ( obj ) { if ( obj && obj . _ _esModule ) { return obj ; } else { var newObj = { } ; if ( obj != null ) { for ( var key in obj ) { if ( Object . prototype . hasOwnProperty . call ( obj , key ) ) { var desc = Object . defineProperty && Object . getOwnPropertyDescriptor ? Object . getOwnPropertyDescriptor ( obj , key ) : { } ; if ( desc . get || desc . set ) { Object . defineProperty ( newObj , key , desc ) ; } else { newObj [ key ] = obj [ key ] ; } } } } newObj . default = obj ; return newObj ; } }
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
function _typeof ( obj ) { if ( typeof Symbol === "function" && typeof Symbol . iterator === "symbol" ) { _typeof = function _typeof ( obj ) { return typeof obj ; } ; } else { _typeof = function _typeof ( obj ) { return obj && typeof Symbol === "function" && obj . constructor === Symbol && obj !== Symbol . prototype ? "symbol" : typeof obj ; } ; } return _typeof ( obj ) ; }
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
function _defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } }
function _createClass ( Constructor , protoProps , staticProps ) { if ( protoProps ) _defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) _defineProperties ( Constructor , staticProps ) ; return Constructor ; }
function _possibleConstructorReturn ( self , call ) { if ( call && ( _typeof ( call ) === "object" || typeof call === "function" ) ) { return call ; } return _assertThisInitialized ( self ) ; }
function _getPrototypeOf ( o ) { _getPrototypeOf = Object . setPrototypeOf ? Object . getPrototypeOf : function _getPrototypeOf ( o ) { return o . _ _proto _ _ || Object . getPrototypeOf ( o ) ; } ; return _getPrototypeOf ( o ) ; }
function _inherits ( subClass , superClass ) { if ( typeof superClass !== "function" && superClass !== null ) { throw new TypeError ( "Super expression must either be null or a function" ) ; } subClass . prototype = Object . create ( superClass && superClass . prototype , { constructor : { value : subClass , writable : true , configurable : true } } ) ; if ( superClass ) _setPrototypeOf ( subClass , superClass ) ; }
function _setPrototypeOf ( o , p ) { _setPrototypeOf = Object . setPrototypeOf || function _setPrototypeOf ( o , p ) { o . _ _proto _ _ = p ; return o ; } ; return _setPrototypeOf ( o , p ) ; }
function _assertThisInitialized ( self ) { if ( self === void 0 ) { throw new ReferenceError ( "this hasn't been initialised - super() hasn't been called" ) ; } return self ; }
var REQUEST _TYPE _POST = "POST" ;
exports . REQUEST _TYPE _POST = REQUEST _TYPE _POST ;
var REQUEST _TYPE _GET = "GET" ;
exports . REQUEST _TYPE _GET = REQUEST _TYPE _GET ;
var REQUEST _TYPE _PUT = "PUT" ;
exports . REQUEST _TYPE _PUT = REQUEST _TYPE _PUT ;
var REQUEST _TYPE _DELETE = "DELETE" ;
exports . REQUEST _TYPE _DELETE = REQUEST _TYPE _DELETE ;
var CONTENT _TYPE _JSON = 'json' ;
exports . CONTENT _TYPE _JSON = CONTENT _TYPE _JSON ;
var CONTENT _TYPE _FORM = 'x-www-form-urlencoded' ;
exports . CONTENT _TYPE _FORM = CONTENT _TYPE _FORM ;
var DataUtils =
/*#__PURE__*/
function ( _EventEmitter ) {
_inherits ( DataUtils , _EventEmitter ) ;
//--------------------------
// constructor
//--------------------------
function DataUtils ( ) {
var _this ;
_classCallCheck ( this , DataUtils ) ;
_this = _possibleConstructorReturn ( this , _getPrototypeOf ( DataUtils ) . call ( this ) ) ;
var self = _assertThisInitialized ( _assertThisInitialized ( _this ) ) ;
return _this ;
} //--------------------------
// methods
//--------------------------
_createClass ( DataUtils , [ {
key : "request" ,
value : function request ( requestURL , eventType ) {
var requestType = arguments . length > 2 && arguments [ 2 ] !== undefined ? arguments [ 2 ] : REQUEST _TYPE _GET ;
var contentType = arguments . length > 3 && arguments [ 3 ] !== undefined ? arguments [ 3 ] : CONTENT _TYPE _JSON ;
var requestData = arguments . length > 4 && arguments [ 4 ] !== undefined ? arguments [ 4 ] : null ;
var self = this ;
return new Promise ( function ( resolve , reject ) {
var request = new XMLHttpRequest ( ) ;
request . upload . onprogress = self . handleLoadProgress ;
request . open ( requestType , requestURL , true ) ;
request . onload = function ( e ) {
if ( request . status == 200 ) {
resolve ( {
request : request ,
eventType : eventType
} ) ;
} else {
reject ( {
request : request ,
eventType : eventType
} ) ;
}
;
} ;
if ( requestType == REQUEST _TYPE _PUT || requestType == REQUEST _TYPE _POST ) {
switch ( contentType ) {
case CONTENT _TYPE _JSON :
request . setRequestHeader ( "Content-type" , "application/" + contentType ) ;
request . send ( JSON . stringify ( requestData ) ) ;
break ;
case CONTENT _TYPE _FORM :
request . send ( requestData ) ;
break ;
}
} else {
request . send ( ) ;
}
} ) ;
}
} , {
key : "imgLoad" ,
value : function imgLoad ( url ) {
'use strict' ; // Create new promise with the Promise() constructor;
// This has as its argument a function with two parameters, resolve and reject
return new Promise ( function ( resolve , reject ) {
// Standard XHR to load an image
var request = new XMLHttpRequest ( ) ;
request . open ( 'GET' , url ) ;
request . responseType = 'blob' ; // When the request loads, check whether it was successful
request . onload = function ( ) {
if ( request . status === 200 ) {
// If successful, resolve the promise by passing back the request response
resolve ( request . response ) ;
} else {
// If it fails, reject the promise with a error message
reject ( new Error ( 'Image didn\'t load successfully; error code:' + request . statusText ) ) ;
}
} ;
request . onerror = function ( ) {
// Also deal with the case when the entire request fails to begin with
// This is probably a network error, so reject the promise with an appropriate message
reject ( new Error ( 'There was a network error.' ) ) ;
} ; // Send the request
request . send ( ) ;
} ) ;
}
} , {
key : "loadImage" ,
value : function loadImage ( src ) {
'use strict' ;
var self = this ;
return new Promise ( function ( resolve , reject ) {
// Get a reference to the body element, and create a new image object
var body = document . querySelector ( 'body' ) ,
myImage = new Image ( ) ;
myImage . crossOrigin = "" ; // or "anonymous"
// Call the function with the URL we want to load, but then chain the
// promise then() method on to the end of it. This contains two callbacks
self . imgLoad ( src ) . then ( function ( response ) {
// The first runs when the promise resolves, with the request.reponse specified within the resolve() method.
var imageURL = window . URL . createObjectURL ( response ) ;
resolve ( imageURL ) ; //$('background-content').setStyle('background-image', 'url('+imageURL+')') //myImage.src = imageURL;
//console.log(imageURL);
//body.appendChild(myImage);
// The second runs when the promise is rejected, and logs the Error specified with the reject() method.
} , function ( Error ) {
reject ( Error ) ;
} ) ;
} ) ;
} //--------------------------
// event handlers
//--------------------------
} , {
key : "handleLoadProgress" ,
value : function handleLoadProgress ( e ) {
var percentComplete = Math . ceil ( e . loaded / e . total * 100 ) ; //console.log(percentComplete);
}
} ] ) ;
return DataUtils ;
} ( _EventEmitter2 . default ) ;
var _default = DataUtils ;
exports . default = _default ;
} , { "../events/EventEmitter.jsx" : "../../../default/src/com/tools/events/EventEmitter.jsx" , "../events/DataEvent.jsx" : "../../../default/src/com/tools/events/DataEvent.jsx" } ] , "../../../../brain/tools/utilities/DBUtils.js" : [ function ( require , module , exports ) {
"use strict" ;
Object . defineProperty ( exports , "__esModule" , {
value : true
} ) ;
exports . default = void 0 ;
var _DataUtils = _interopRequireDefault ( require ( "../../../themes/default/src/com/tools/utilities/DataUtils" ) ) ;
var _dexie = _interopRequireDefault ( require ( "dexie" ) ) ;
var DataEvent = _interopRequireWildcard ( require ( "../events/DataEvent" ) ) ;
function _interopRequireWildcard ( obj ) { if ( obj && obj . _ _esModule ) { return obj ; } else { var newObj = { } ; if ( obj != null ) { for ( var key in obj ) { if ( Object . prototype . hasOwnProperty . call ( obj , key ) ) { var desc = Object . defineProperty && Object . getOwnPropertyDescriptor ? Object . getOwnPropertyDescriptor ( obj , key ) : { } ; if ( desc . get || desc . set ) { Object . defineProperty ( newObj , key , desc ) ; } else { newObj [ key ] = obj [ key ] ; } } } } newObj . default = obj ; return newObj ; } }
function _interopRequireDefault ( obj ) { return obj && obj . _ _esModule ? obj : { default : obj } ; }
function _classCallCheck ( instance , Constructor ) { if ( ! ( instance instanceof Constructor ) ) { throw new TypeError ( "Cannot call a class as a function" ) ; } }
function _defineProperties ( target , props ) { for ( var i = 0 ; i < props . length ; i ++ ) { var descriptor = props [ i ] ; descriptor . enumerable = descriptor . enumerable || false ; descriptor . configurable = true ; if ( "value" in descriptor ) descriptor . writable = true ; Object . defineProperty ( target , descriptor . key , descriptor ) ; } }
function _createClass ( Constructor , protoProps , staticProps ) { if ( protoProps ) _defineProperties ( Constructor . prototype , protoProps ) ; if ( staticProps ) _defineProperties ( Constructor , staticProps ) ; return Constructor ; }
var DBUtils =
/*#__PURE__*/
function ( ) {
//--------------------------
// constructor
//--------------------------
function DBUtils ( ) {
_classCallCheck ( this , DBUtils ) ;
this . dataUtils = new _DataUtils . default ( ) ;
this . db = new _dexie . default ( "fipamo_posts" ) ;
this . db . version ( 1 ) . stores ( {
postList : 'id,post'
} ) ;
} //--------------------------
// methods
//--------------------------
_createClass ( DBUtils , [ {
key : "resetLocal" ,
value : function resetLocal ( array ) {
var self = this ;
return new Promise ( function ( resolve , reject ) {
self . db . postList . clear ( ) . then ( function ( result ) {
self . db . postList . bulkAdd ( array ) . then ( function ( key ) {
self . db . postList . toArray ( function ( array ) {
var event = DataEvent . LOCAL _DB _READY ;
resolve ( {
event : event
} ) ;
} ) ;
} ) . catch ( _dexie . default . BulkError , function ( e ) {
reject ( {
e : e
} ) ;
} ) ;
} ) ;
} ) ;
} //--------------------------
// event handlers
//--------------------------
} ] ) ;
return DBUtils ;
} ( ) ;
exports . default = DBUtils ;
} , { "../../../themes/default/src/com/tools/utilities/DataUtils" : "../../../default/src/com/tools/utilities/DataUtils.jsx" , "dexie" : "../../../../node_modules/dexie/dist/dexie.es.js" , "../events/DataEvent" : "../../../../brain/tools/events/DataEvent.js" } ] , "Base.js" : [ function ( require , module , exports ) {
"use strict" ;
"use strict" ;
Object . defineProperty ( exports , "__esModule" , {
Object . defineProperty ( exports , "__esModule" , {
@ -38005,7 +37756,7 @@ function () {
} ) ;
} ) ;
}
}
self . dbUtils . reset Local( list ) . then ( function ( r ) {
self . dbUtils . sync Local( list ) . then ( function ( r ) {
self . start ( ) ;
self . start ( ) ;
} ) . catch ( function ( err ) {
} ) . catch ( function ( err ) {
console . log ( err ) ;
console . log ( err ) ;