1/** 2 * Module Profile 3 * @description 4 * @author Alejandro Micheloud 5 */ 6 7var StudentProfileManager = function (sco) { 8 var scope = sco; 9 var builded = false; 10 var section = null; 11 12 // internal modules 13 var mProfile = null, mPoints = null, mAlbum = null; 14 15 /** 16 * Se invoca cuando el módulo recibe foco 17 * @returns {undefined} 18 */ 19 function show(_section) { 20 console.log("StudentProfileManager:show('" + _section + "');"); 21 section = _section; 22 if (!builded) { 23 build(doStart); 24 } else { 25 doStart(); 26 } 27 } 28 29 function doStart() { 30 31 mDiscover.showLoading(); 32 mDiscover.refreshGameData(function (err) { 33 34 mDiscover.hideLoading(); 35 $(".header .image-top-profile .d-student-avatar").html(getHtmlStudentAvatar(mDiscover.getUser(), "") + getHtmlUpdateImagen()); 36 37 var stars = parseInt($(".header .image-top-profile .d-student-avatar .d-student-icon").attr("stars")); 38 mTooltip.setTooltip($(".header .image-top-profile .d-student-avatar .d-stars .d-star"), lang["classroom_projects_students_card_tooltip_star_" + stars]); 39 40 $(".header .image-top-profile .d-student-avatar .d-update-imagen").off("click").on("click", function () { 41 42 //$(".header .image-top-profile .d-student-avatar #m-student-profile-image-file").trigger("click"); 43 var avatar = (mDiscover.getUser().avatar !== "" && mDiscover.getUser().avatar !== null) ? mDiscover.getUser().avatar : "css/img/profile.jpg"; 44 mAvatar.show({type: "user"}, avatar, function (err, data) { 45 if (!err) { 46 if (data !== null) { 47 mDiscover.updUserProfile({"avatar": data.filename_icon}); 48 mAvatar.hide(); 49 } 50 } 51 }); 52 }); 53 }); 54 55 56 57 showTab(); 58 } 59 function showTab() { 60 console.log("showTab:section:" + section); 61 62 $(".d-module .header .d-header-section.project-tab.profile .d-tab-bt").removeClass("active"); 63 $(".d-module .header .d-header-section.project-tab.profile .d-tab-bt[section='" + section + "']").addClass("active"); 64 scope.find(".d-student-profile-container").show(); 65 scope.find(".d-tab-content").hide(); 66 scope.find(".d-tab-content." + section).show(); 67 switch (section) { 68 case "profile": 69 mProfile.show(); 70 break; 71 case "points": 72 mPoints.show(); 73 break; 74 case "album": 75 mAlbum.show(); 76 break; 77 } 78 } 79 80 function onUpdateUser() { 81 console.log("onUpdateUser()"); 82 if (mDiscover.getUser().avatar !== "") { 83 $(".header .image-top-profile .d-student-avatar .d-avatar-image").attr("style", "background-image:url(" + mDiscover.getUser().avatar + "?t=" + new Date().getTime() + ")"); 84 } 85 } 86 /** 87 * Constructor de módulo 88 * @returns {undefined} 89 */ 90 function build(callback) { 91 92 builded = true; 93 94 scope.append(getHtmlModule()); 95 96 mProfile = new StudentProfileProfile(scope.find(".d-tab-content.profile")); 97 mPoints = new StudentProfilePoints(scope.find(".d-tab-content.points")); 98 mAlbum = new StudentProfileAlbum(scope.find(".d-tab-content.album")); 99 100 // tab control 101 $("main .m-home.d-student .header .d-header-section.project-tab.profile .d-tab-bt").click(function () { 102 routie("student/profile/" + $(this).attr("section")); 103 }); 104 105 $("body").off("on_update_user", onUpdateUser).on("on_update_user", onUpdateUser); 106 107 if (isFunction(callback)) { 108 callback(); 109 } 110 } 111 112 /** 113 * Constructor 114 * @returns {undefined} 115 */ 116 function init() { 117 // nada, latente hasta show 118 } 119 init(); 120 121 // helpers 122 /* html of module */ 123 function getHtmlModule() { 124 return '<div class="d-student-profile-container">' + 125 ' <div class="d-tab-content profile">' + 126 ' </div>' + 127 ' <div class="d-tab-content points">' + 128 ' </div>' + 129 ' <div class="d-tab-content album">' + 130 ' </div>' + 131 '</div>'; 132 } 133 function getHtmlUpdateImagen() { 134 return '<div class="d-update-imagen text-standard-shadow-1">' + lang.profile_avatar_change + '</div><input type="file" id="m-student-profile-image-file" accept="image/*" />'; 135 } 136 137 // public methods 138 this.show = show; 139};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.