<commit_before>function User(args) {
    var self = this;
    self.id = args.id;
    self.nickname = args.nickname;
    self.displayName = args.displayName;
    self.flattrUserName = args.flattr_user_name;
    self.email = args.email || '';
    self.largeImageUrl = args.largeImageUrl || null;
    self.smallImageUrl = args.smallImageUrl || null;
    self.firstName = args.firstName || '';
    self.lastName = args.lastName || '';
    self.fullName = $.trim(self.firstName + ' ' + self.lastName);
    self.tagline = args.tagline || '';
    self.playlists = [];
    self.followings = args.followings || [];
    self.followers = args.followers || [];

    if (args.playlists) {
        $.each(args.playlists, function(i, item) {
            self.playlists.push(new Playlist(item.title, item.videos, item.remoteId, item.owner, item.isPrivate, item.followers));
        });
    }

    self.saveProfile = function(params) {
        LoadingBar.show();

        $.ajax({
            type : 'POST',
            url : '/me/profile',
            data : params,
            statusCode : {
                200 : function(data, textStatus) {
                    LoadingBar.hide();
                    params.displayName = data;
                    EventSystem.callEventListeners('user_profile_updated', params);
                },
                400 : function(data, textStatus) {
                    alert(data.responseText);
                    LoadingBar.hide();
                },
                409 : function(data) {
                    alert('Nickname is already taken');
                    LoadingBar.hide();
                }
            }
        });
    };

    self.getUrl = function() {
        if (this.nickname) {
            return '/users/' + this.nickname;
        } else {
            return '/users/' + this.id;
        }
    };

    self.addFollower = function(userId, userDisplayName, smallImageUrl) {
        self.followers.push({
            id: userId,
            displayName: userDisplayName,
            smallImageUrl: smallImageUrl
        });
    };

    self.removeFollower = function(userId) {
        var newFollowers = [];
        $.each(self.followers, function(i, item) {
            if (item.id !== userId) {
                newFollowers.push(item);
            }
        });
        self.followers = newFollowers;
    };

    self.removeFollowing = function(userId) {
        var newFollowings = [];
        $.each(self.followings, function(i, item) {
            if (item.id !== userId) {
                newFollowings.push(item);
            }
        });
        self.followings = newFollowings;
    };

    self.addFollowing = function(userId, userDisplayName, smallImageUrl) {
        self.followings.push({
            id: userId,
            displayName: userDisplayName,
            smallImageUrl: smallImageUrl
        });
    };

    self.getSmallView = function() {
        var $user = $('<span class="user small link"></span>');

        $('<img />').attr('src', self.smallImageUrl).appendTo($user);
        $('<span class="name"></span>').text(self.displayName).appendTo($user);

        $user.click(function() {
            history.pushState(null, null, self.getUrl());
            UserManager.doFakeProfileMenuClick();
            if (logged_in && self.id === UserManager.currentUser.id) {
                UserManager.loadCurrentUser();
            } else {
                UserManager.loadProfile(self.id);
            }
        });

        return $user;
    },

    self.isFollowingUser = function(userId) {
        var ret = false;

        $.each(self.followings, function(i, item) {
            if (item.id === userId) {
                ret = true;
                return false;
            }
        });

        return ret;
    };
}<commit_msg>Fix JSLint issues<commit_after>function User(args) {
    var self = this;
    self.id = args.id;
    self.nickname = args.nickname;
    self.displayName = args.displayName;
    self.flattrUserName = args.flattr_user_name;
    self.email = args.email || '';
    self.largeImageUrl = args.largeImageUrl || null;
    self.smallImageUrl = args.smallImageUrl || null;
    self.firstName = args.firstName || '';
    self.lastName = args.lastName || '';
    self.fullName = $.trim(self.firstName + ' ' + self.lastName);
    self.tagline = args.tagline || '';
    self.playlists = [];
    self.followings = args.followings || [];
    self.followers = args.followers || [];

    if (args.playlists) {
        $.each(args.playlists, function(i, item) {
            self.playlists.push(new Playlist(item.title, item.videos, item.remoteId, item.owner, item.isPrivate, item.followers));
        });
    }

    self.saveProfile = function(params) {
        LoadingBar.show();

        $.ajax({
            type : 'POST',
            url : '/me/profile',
            data : params,
            statusCode : {
                200 : function(data, textStatus) {
                    LoadingBar.hide();
                    params.displayName = data;
                    EventSystem.callEventListeners('user_profile_updated', params);
                },
                400 : function(data, textStatus) {
                    alert(data.responseText);
                    LoadingBar.hide();
                },
                409 : function(data) {
                    alert('Nickname is already taken');
                    LoadingBar.hide();
                }
            }
        });
    };

    self.getUrl = function() {
        if (this.nickname) {
            return '/users/' + this.nickname;
        } else {
            return '/users/' + this.id;
        }
    };

    self.addFollower = function(userId, userDisplayName, smallImageUrl) {
        self.followers.push({
            id: userId,
            displayName: userDisplayName,
            smallImageUrl: smallImageUrl
        });
    };

    self.removeFollower = function(userId) {
        var newFollowers = [];
        $.each(self.followers, function(i, item) {
            if (item.id !== userId) {
                newFollowers.push(item);
            }
        });
        self.followers = newFollowers;
    };

    self.removeFollowing = function(userId) {
        var newFollowings = [];
        $.each(self.followings, function(i, item) {
            if (item.id !== userId) {
                newFollowings.push(item);
            }
        });
        self.followings = newFollowings;
    };

    self.addFollowing = function(userId, userDisplayName, smallImageUrl) {
        self.followings.push({
            id: userId,
            displayName: userDisplayName,
            smallImageUrl: smallImageUrl
        });
    };

    self.getSmallView = function() {
        var $user = $('<span class="user small link"></span>');

        $('<img />').attr('src', self.smallImageUrl).appendTo($user);
        $('<span class="name"></span>').text(self.displayName).appendTo($user);

        $user.click(function() {
            history.pushState(null, null, self.getUrl());
            UserManager.doFakeProfileMenuClick();
            if (logged_in && self.id === UserManager.currentUser.id) {
                UserManager.loadCurrentUser();
            } else {
                UserManager.loadProfile(self.id);
            }
        });

        return $user;
    };

    self.isFollowingUser = function(userId) {
        var ret = false;

        $.each(self.followings, function(i, item) {
            if (item.id === userId) {
                ret = true;
                return false;
            }
        });

        return ret;
    };
}
{'fraction_non_alphanumeric': 0.13484329734000527, 'fraction_numerical': 0.00237029233605478, 'mean_word_length': 1.6695957820738137, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7610743', 'n_tokens_mistral': 2171, 'n_tokens_neox': 2095, 'n_words': 364}