FloatButton.js 1.02 KB
define(function () {
    'use strict';

    var contentTypes = {
        IMG: "1",
        TEXT: "2"
    };

    function FloatButton() {
        this.store = {
            positionType: "left_bottom",
            img: "",
            text: "",
            remind: "0"
        };
    }

    FloatButton.prototype = {
        transferToVM: function (dm) {
            var img = dm.img;
            var text = dm.text;
            var ct = dm.contentType;
            var wordsClass = "";

            if(ct == contentTypes.IMG) {
                text = "";
            } else if(ct == contentTypes.TEXT) {
                img = "";
    			if(text){
    				if(text.length == 4){
    					wordsClass = "fourletters";
    				}else if(text.length > 4){
    					wordsClass = "wordsLoop";
    				}
    			} 
            }
            
            return {
                img: img,
                text: text,
                remind: dm.remind == 1,
                wordsClass: wordsClass
            }
        }
    };

    return FloatButton;
});