post/static/post/main.js
/**
 * Create a temporary div, append it to the div'#response', fix it to the top and fade it.
 * @param {int} status - an integer based upon the response received for AJAX request.
 * (-1->'error'|0->'success'| 1->'warning')
 * @param {string} msg - a string depicting the message to be displayed in the response.
 * @param {int} time - time after which the response fades away
 */
Create a temporary div, append it to the div'#response', fix it to the top and fade it.
@param {int} status - an integer based upon the response received for AJAX request.
Create a temporary div append it to the div ' #response ' fix it to the top and fade it . @param { int } status - an integer based upon the response received for AJAX request .
function createResponse(status, msg, time = 5000) {
    switch (status) {
        case -1:
            status = "danger";
            break;
        case 0:
            status = "success";
            break;
        case 1:
            status = "warning";
    }
    const cls = 'alert alert-' + status;
    const response = jq('#response');
    const temp = jq('<div/>')
        .addClass(cls)
        .html('<div>' + msg + '</div>');
    response.append(temp);
    fixToTop(temp);
    temp.fadeIn(time);
    temp.fadeOut(2 * time);
    setTimeout(function () {
        temp.remove();
    }, 2 * time + 10);
}
function createResponse ( status , msg , time = 5000 ) { switch ( status ) { case - 1 : status = "danger" ; break ; case 0 : status = "success" ; break ; case 1 : status = "warning" ; } const cls = 'alert alert-' + status ; const response = jq ( '#response' ) ; const temp = jq ( '<div/>' ) . addClass ( cls ) . html ( '<div>' + msg + '</div>' ) ; response . append ( temp ) ; fixToTop ( temp ) ; temp . fadeIn ( time ) ; temp . fadeOut ( 2 * time ) ; setTimeout ( function ( ) { temp . remove ( ) ; } , 2 * time + 10 ) ; }
Create a temporary div, append it to the div'#response', fix it to the top and fade it.
Create a temporary div append it to the div ' #response ' fix it to the top and fade it .
// console.log(temp);