<commit_before>'use strict';

var $ = require('jquery');

module.exports = function(shariff) {

    var config = {
        handle: 'heiseonline'
    };

    // abbreviate at last blank before length and add "\u2026" (horizontal ellipsis)
    var abbreviateText = function(text, length) {
        var abbreviated = decodeURIComponent(text);
        if (abbreviated.length <= length) {
            return text;
        }

        var lastWhitespaceIndex = abbreviated.substring(0, length - 1).lastIndexOf(' ');
        abbreviated = encodeURIComponent(abbreviated.substring(0, lastWhitespaceIndex)) + '\u2026';

        return abbreviated;
    };

    // create tweet text from content of <meta name="DC.title"> and <meta name="DC.creator">
    // fallback to content of <title> tag
    var getTweetText = function() {
        var title = shariff.getMeta('DC.title');
        var creator = shariff.getMeta('DC.creator');

        if (title.length > 0 && creator.length > 0) {
            title += ' - ' + creator;
        } else {
            title = $('title').text();
        }
        // 120 is the max character count left after twitters automatic url shortening with t.co
        return encodeURIComponent( abbreviateText(title, 120) );
    };

    return {
        popup: true,
        shareText: 'tweet',
        name: 'twitter',
        shareUrl: 'https://twitter.com/intent/tweet?text='+ getTweetText() + '&url=' + shariff.getURL() + shariff.getReferrerTrack() + '&via=' + config.handle
    };
};
<commit_msg>remove unused "via" feature<commit_after>'use strict';

var $ = require('jquery');

module.exports = function(shariff) {

    // abbreviate at last blank before length and add "\u2026" (horizontal ellipsis)
    var abbreviateText = function(text, length) {
        var abbreviated = decodeURIComponent(text);
        if (abbreviated.length <= length) {
            return text;
        }

        var lastWhitespaceIndex = abbreviated.substring(0, length - 1).lastIndexOf(' ');
        abbreviated = encodeURIComponent(abbreviated.substring(0, lastWhitespaceIndex)) + '\u2026';

        return abbreviated;
    };

    // create tweet text from content of <meta name="DC.title"> and <meta name="DC.creator">
    // fallback to content of <title> tag
    var getTweetText = function() {
        var title = shariff.getMeta('DC.title');
        var creator = shariff.getMeta('DC.creator');

        if (title.length > 0 && creator.length > 0) {
            title += ' - ' + creator;
        } else {
            title = $('title').text();
        }
        // 120 is the max character count left after twitters automatic url shortening with t.co
        return encodeURIComponent( abbreviateText(title, 120) );
    };

    return {
        popup: true,
        shareText: 'tweet',
        name: 'twitter',
        shareUrl: 'https://twitter.com/intent/tweet?text='+ getTweetText() + '&url=' + shariff.getURL() + shariff.getReferrerTrack()
    };
};

{'fraction_non_alphanumeric': 0.13297333783327708, 'fraction_numerical': 0.01282483968950388, 'mean_word_length': 2.5412186379928317, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 13, 'https://': 2, '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': '2854306', 'n_tokens_mistral': 934, 'n_tokens_neox': 862, 'n_words': 223}