MyData > Upload dialog

by lasha

HTML

<script src="//cdnjs.cloudflare.com/ajax/libs/less.js/1.7.0/less.min.js"></script>
<div class="fileProgressContainer">
    <div class="progressHeader">Transfers in Progress <span class="btnClose"></span>  <span class="btnCollapseToggle"></span> 
    </div>
    <div class="progressOptions"> <span class="btnCancelAll">Cancel All</span> 
    </div>
    <div class="progressFiles">
        <div class="progressListWrapper">
            <ul></ul>
        </div>
    </div>
</div>

CSS

.fileProgressContainer {
    display: none;
    font-family: helvetica;
    font-size: 12px;
    position: absolute;
    width: 400px;
    // height: 220px;
    // border: 1px solid #ccc;
    bottom: 0;
    right: 20px;
    max-height: 100%;
    overflow: hidden;
    -webkit-transition: height 0.2s linear;
    -moz-transition: height 0.2s linear;
    transition: height 0.2s linear;
    -webkit-backface-visibility: hidden;
    -webkit-font-smoothing: antialiased;
    &.collapsed {
        height: 26px !important;
        
        .progressHeader .btnCollapseToggle {
            background-position: center -86px;
        }
    }
    
    .progressHeader {
        color: #fff;
        background-color: #4a8cf4;
        padding: 6px 8px;
        font-weight: bold;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        
        .btnCollapseToggle {
            float: right;
            width: 14px;
            height: 10px;
            background: url('http://oi58.tinypic.com/xp78s1.jpg') no-repeat;
            background-position: center -83px;
            margin-top: 2px;
            cursor: pointer;
            /* &:hover {
                text-decoration: underline;
            } */
        }
        
        .btnClose {
            display: none;
            float: right;
            width: 14px;
            height: 10px;
            background: url('http://oi58.tinypic.com/xp78s1.jpg') no-repeat;
            background-position: center -37px;
            margin-top: 1px;
            margin-left: 7px;
            cursor: pointer;
        }
    }
    
    .progressOptions {
        border: 1px solid #adadad;
        border-bottom: 0; border-top: 0;
        text-align: right;
        background-color: #e5e5e5;
        color: #555;
        padding: 4px 6px;
        
        span {
            cursor: pointer;
            &:hover {
                text-decoration: underline;
            }
        }
   ...

JavaScript

// Step 1: Select the style element and change it to text/less
$('head style[type="text/css"]').attr('type', 'text/less');
// Step 2: Tell LESS to refresh the styles
less.refreshStyles();

/*----------------------------------------------------------
//   Micro JavaScript Templating   xtpl (minified version)
//   Leo Lems - http://2basix.nl - MIT Licensed
------------------------------------------------------------*/
(function(){this.xtpl=function xtpl(templatestring,data){var ret='',xfn=new Function("o","var arr=['"+templatestring.replace(/[\r\t\n]/g,"").split("'").join("\\'").replace(/{%=\s*\(\s*(.+?)\s*\)\s*%}/g,"',($1),'").replace(/{%=\s*(.+?)\s*%}/g,"',(o.$1)?o.$1:'','")+"']; return arr.join('');");if(!data){return xfn}return xfn(data)}})();

var progressData = {
    "globalState": "done",
    // "globalState": "inProgress",
    // "globalState": "cancelled",
    "files": {
        "file00": {
            "fileID": "238502358592341",
            "fileStatus": "cancelled",
            "fileName": "Protected_green001.png",
            "filePercentDownloaded": "0",
            "fileProgress": "12MB of 48MB",
            "fileDirection": "down",
            "fileSize": "42 MB",
            "error": {
                "display": "error",
                "message": "Server communication error, try again!"
            }
        },
        "file01": {
            "fileID": "238502358592342",
            "fileStatus": "inProgress",
            "fileName": "Protected_green.png",
            "filePercentDownloaded": "20",
            "fileProgress": "12MB of 48MB",
            "fileDirection": "down",
            "fileSize": "16 MB",
            "error": {
                "display": "no-error",
                "message": ""
            }
        },
        "file02": {
            "fileID": "238502358592343",
            "fileStatus": "inProgress2",
            "fileName": "Protected_green2222reallyLongFileNameGoesHere.png",
            "filePercentDownloaded": "60",
    ...