FloatButton.js
1.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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;
});