<commit_before>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
;(function(w, $, TweenMax, TimelineLite, Power2, Quad) {
    'use strict';

    // i heard document.ready isn't necessary anymore. just trying it out...
    //$(document).ready(function () {
        $('#foxtail').sprite({fps: 12, no_of_frames: 44, rewind: true});

        // Smooth scroll-to for left menu navigation
        $('#partner-nav a, #nav-main-menu a').click(function(e) {
            var elementClicked = $(this).attr("href");
            var destination;

            // all <article>'s have set height and position
            switch (elementClicked) {
                case '#overview':
                    destination = 0;
                    break;
                case '#os':
                    destination = 680;
                    break;
                case '#marketplace':
                    destination = 1360;
                    break;
                case '#android':
                    destination = 2040;
                    break;
            }

            $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination }, 700);
            return false;
        });

        var $giantfox = $('#giantfox');
        var $giantfox_tail = $('#giantfox-foreground');
        var $phone = $('#phone-common');
        var $phone_android = $('#phone-android');
        var $overview = $('#overview');
        var $os = $('#os');
        var $marketplace = $('#marketplace');
        var $android = $('#android');

        // side scrolling sections
        $('.view-section').on('click', function(e) {
            e.preventDefault();

            // needed to calculate percentage offsets?
            var doc_width = $(w.document).width();

            var link = $(this);

            var article = link.parents('article:first');

            // which section is currently displayed?
            var orig = article.find('section[data-current="1"]:first');
            var orig_pos = Number(orig.data('pos'));

            // which section are we going to?
            var dest = $('#' + link.data('section'));
            var dest_pos = Number(dest.data('pos'));

            // what's the difference in position? multiply by 100 to get percentage
            var delta = (dest_pos - orig_pos) * 100;

            article.find('section').each(function(i, el) {
                var section = $(el);

                // percentage position of this section
                // (left will be in px and will be multiple of doc_width)
                var el_left = (section.position().left/doc_width) * 100;

                var new_left = el_left - delta;

                section.css('left', new_left + '%').attr('data-current', 0);
            });

            // update current section
            dest.attr('data-current', 1);

            // slide phone?
            if (dest_pos > 1) {
                $phone.animate({ 'left': '-50%' }, 500);
            } else {
                $phone.animate({ 'left': '50%' }, 500);
            }
        });

        $('a[data-section="os-operators"]').on('click', function() {
            $giantfox.css('left', '-45%');
        });

        $('a[data-section="os-overview"]').on('click', function() {
            $giantfox.css('left', '45%');
        });

        var _transition_tail = function(z_index, opacity, top) {
            $giantfox_tail.css({
                'z-index': z_index,
                'opacity': opacity,
                'top': top
            });
        };

        var _move_phone = function(top_pos, slide) {
            if (Number(slide.find('section:first').attr('data-current')) === 1) {
                if ($phone.css('left') === '-50%') {
                    $phone.animate({
                        top: top_pos
                    }, 100, function() {
                        $phone.animate({ 'left': '50%' }, 500);
                    });
                } else {
                    $phone.animate({ 'top': top_pos + 'px' }, 500);
                }
            } else {
                if ($phone.css('left') !== '-50%') {
                    $phone.animate({
                        'left': '-50%'
                    }, 500, function() {
                        $phone.css('top', top_pos + 'px');
                    });
                } else {
                    $phone.animate({ 'top': top_pos + 'px' }, 500);
                }
            }
        };

        var controller = $.superscrollorama();

        var tweens = {};

        tweens.slide_up = {
            from: {
                css: { top: 80, opacity: 0 },
                immediateRender: true
            },
            to: { css: { top: 0, opacity: 1 } }
        };

        tweens.article_os = {
            from: {
                css: { top: 0, ease: Power2.easeOut },
                immediateRender: true
            },<commit_msg>Fixed phone left bug.<commit_after>/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
;(function(w, $, TweenMax, TimelineLite, Power2, Quad) {
    'use strict';

    // i heard document.ready isn't necessary anymore. just trying it out...
    //$(document).ready(function () {
        $('#foxtail').sprite({fps: 12, no_of_frames: 44, rewind: true});

        // Smooth scroll-to for left menu navigation
        $('#partner-nav a, #nav-main-menu a').click(function(e) {
            var elementClicked = $(this).attr("href");
            var destination;

            // all <article>'s have set height and position
            switch (elementClicked) {
                case '#overview':
                    destination = 0;
                    break;
                case '#os':
                    destination = 680;
                    break;
                case '#marketplace':
                    destination = 1360;
                    break;
                case '#android':
                    destination = 2040;
                    break;
            }

            $("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination }, 700);
            return false;
        });

        var $giantfox = $('#giantfox');
        var $giantfox_tail = $('#giantfox-foreground');
        var $phone = $('#phone-common');
        var $phone_android = $('#phone-android');
        var $overview = $('#overview');
        var $os = $('#os');
        var $marketplace = $('#marketplace');
        var $android = $('#android');

        // side scrolling sections
        $('.view-section').on('click', function(e) {
            e.preventDefault();

            // needed to calculate percentage offsets?
            var doc_width = $(w.document).width();

            var link = $(this);

            var article = link.parents('article:first');

            // which section is currently displayed?
            var orig = article.find('section[data-current="1"]:first');
            var orig_pos = Number(orig.data('pos'));

            // which section are we going to?
            var dest = $('#' + link.data('section'));
            var dest_pos = Number(dest.data('pos'));

            // what's the difference in position? multiply by 100 to get percentage
            var delta = (dest_pos - orig_pos) * 100;

            article.find('section').each(function(i, el) {
                var section = $(el);

                // percentage position of this section
                // (left will be in px and will be multiple of doc_width)
                var el_left = (section.position().left/doc_width) * 100;

                var new_left = el_left - delta;

                section.css('left', new_left + '%').attr('data-current', 0);
            });

            // update current section
            dest.attr('data-current', 1);

            // slide phone?
            if (dest_pos > 1) {
                $phone.animate({ 'left': '-50%' }, 500);
            } else {
                $phone.animate({ 'left': '50%' }, 500);
            }
        });

        $('a[data-section="os-operators"]').on('click', function() {
            $giantfox.css('left', '-45%');
        });

        $('a[data-section="os-overview"]').on('click', function() {
            $giantfox.css('left', '45%');
        });

        var _transition_tail = function(z_index, opacity, top) {
            $giantfox_tail.css({
                'z-index': z_index,
                'opacity': opacity,
                'top': top
            });
        };

        var _move_phone = function(top_pos, slide) {
            var cur_left = parseInt($phone.css('left'), 10);

            if (Number(slide.find('section:first').attr('data-current')) === 1) {
                if (cur_left < 0) {
                    $phone.animate({
                        top: top_pos
                    }, 100, function() {
                        $phone.animate({ 'left': '50%' }, 500);
                    });
                } else {
                    $phone.animate({ 'top': top_pos + 'px' }, 500);
                }
            } else {
                if (cur_left > 0) {
                    $phone.animate({
                        'left': '-50%'
                    }, 500, function() {
                        $phone.css('top', top_pos + 'px');
                    });
                } else {
                    $phone.animate({ 'top': top_pos + 'px' }, 500);
                }
            }
        };

        var controller = $.superscrollorama();

        var tweens = {};

        tweens.slide_up = {
            from: {
                css: { top: 80, opacity: 0 },
                immediateRender: true
            },
            to: { css: { top: 0, opacity: 1 } }
        };

        tweens.article_os = {
            from: {
                css: { top: 0, ease: Power2.easeOut },
                immediateRender: true
            },
{'fraction_non_alphanumeric': 0.14866732477788747, 'fraction_numerical': 0.01618953603158934, 'mean_word_length': 1.365950490425035, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 8, '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': '2539377', 'n_tokens_mistral': 2912, 'n_tokens_neox': 2611, 'n_words': 679}