<commit_before>/*
 * Copyright (C) 2012 - 2014  <NAME>  http://zhuzhu.org
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

/*jslint browser: true */
/*global $: false, chrome: false, ga_report_event: false */

function set_i18n_text() {
    "use strict";
    var get_msg = chrome.i18n.getMessage;

    $('div#mode_select strong').html(get_msg('mode_select'));

    $('span.mode_lite_name').html(get_msg('mode_lite'));
    $('span.mode_lite_desc').html(get_msg('mode_lite_description'));
    $('span.mode_normal_name').html(get_msg('mode_normal'));
    $('span.mode_normal_desc').html(get_msg('mode_normal_description'));
    $('span.mode_redirect_name').html(get_msg('mode_redirect'));
    $('span.mode_redirect_desc').html(get_msg('mode_redirect_description'));

    $('div#help_text').html(get_msg('help'));
    $('div#feedback').html(get_msg('feedback'));
    $('div#rating').html(get_msg('rating'));
    $('span#sharing_text').html(get_msg('sharing'));
    
    $('div#support_title strong').html(get_msg('support_title'));
    $('span#support_checkbox_label').html(get_msg('support_checkbox_label'));
}

function is_flash_bug_fixed() {
    return !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0 || parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) >= 38;
}


$(document).ready(function() {
    "use strict";
    set_i18n_text();

    var background = chrome.extension.getBackgroundPage();

    // set default button display
    background.get_mode_name(function(current_mode_name) {
        switch (current_mode_name) {
            case 'lite':
                $('label#lite').addClass('active');
                break;
            case 'redirect':
                $('label#redirect').addClass('active');
                break;
            default:
                $('label#normal').addClass('active');
                break;
        }

        // append system info to the wufoo feedback link
        // such as extension version, chrome version, and os type
        var locale = navigator.language.substr(0, 2);
        if (locale === 'en' || locale === 'zh') {
            // jQuery.browser is not always accurate
            var system_info = 'Unblock Youku ' + background.unblock_youku.version;
            system_info += ' (' + current_mode_name + ', ' + locale + '); ';
            system_info += navigator.userAgent;
            console.log(system_info);

            var feedback_url = $('#feedback a');
            feedback_url.prop('href', feedback_url.prop('href') + '/def/field13=' + encodeURIComponent(system_info));
        }
    });
<commit_msg>fix the bug that %2F cannot be properly handled by wufoo<commit_after>/*
 * Copyright (C) 2012 - 2014  <NAME>  http://zhuzhu.org
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */

/*jslint browser: true */
/*global $: false, chrome: false, ga_report_event: false */

function set_i18n_text() {
    "use strict";
    var get_msg = chrome.i18n.getMessage;

    $('div#mode_select strong').html(get_msg('mode_select'));

    $('span.mode_lite_name').html(get_msg('mode_lite'));
    $('span.mode_lite_desc').html(get_msg('mode_lite_description'));
    $('span.mode_normal_name').html(get_msg('mode_normal'));
    $('span.mode_normal_desc').html(get_msg('mode_normal_description'));
    $('span.mode_redirect_name').html(get_msg('mode_redirect'));
    $('span.mode_redirect_desc').html(get_msg('mode_redirect_description'));

    $('div#help_text').html(get_msg('help'));
    $('div#feedback').html(get_msg('feedback'));
    $('div#rating').html(get_msg('rating'));
    $('span#sharing_text').html(get_msg('sharing'));
    
    $('div#support_title strong').html(get_msg('support_title'));
    $('span#support_checkbox_label').html(get_msg('support_checkbox_label'));
}

function is_flash_bug_fixed() {
    return !!window.opera || navigator.userAgent.indexOf(' OPR/') >= 0 || parseInt(window.navigator.appVersion.match(/Chrome\/(\d+)\./)[1], 10) >= 38;
}


$(document).ready(function() {
    "use strict";
    set_i18n_text();

    var background = chrome.extension.getBackgroundPage();

    // set default button display
    background.get_mode_name(function(current_mode_name) {
        switch (current_mode_name) {
            case 'lite':
                $('label#lite').addClass('active');
                break;
            case 'redirect':
                $('label#redirect').addClass('active');
                break;
            default:
                $('label#normal').addClass('active');
                break;
        }

        // append system info to the wufoo feedback link
        // such as extension version, chrome version, and os type
        var locale = navigator.language.substr(0, 2);
        if (locale === 'en' || locale === 'zh') {
            // jQuery.browser is not always accurate
            var system_info = 'Unblock Youku ' + background.unblock_youku.version;
            system_info += ' (' + current_mode_name + ', ' + locale + '); ';
            system_info += navigator.userAgent;
            console.log(system_info);
            system_info = encodeURIComponent(system_info).replace(/%2F/g, '/');  // NOTICEME
            console.log(system_info);

            var feedback_url = $('#feedback a');
            feedback_url.prop('href', feedback_url.prop('href') + '/def/field13=' + system_info);
        }
    });

{'fraction_non_alphanumeric': 0.14742424242424243, 'fraction_numerical': 0.00787878787878788, 'mean_word_length': 3.177848101265823, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2065217', 'n_tokens_mistral': 1999, 'n_tokens_neox': 1910, 'n_words': 465}