<commit_before>/*!
 * Bootstrap YouTube Popup Player Plugin
 * http://lab.abhinayrathore.com/bootstrap-youtube/
 * https://github.com/abhinayrathore/Bootstrap-Youtube-Popup-Player-Plugin
 */
(function ($) {
    var $YouTubeModal = null,
        $YouTubeModalDialog = null,
        $YouTubeModalContent = null,
        $YouTubeModalTitle = null,
        $YouTubeModalBody = null,
        margin = 5;

    //Plugin methods
    var methods = {
        //initialize plugin
        init: function (options) {
            options = $.extend({}, $.fn.YouTubeModal.defaults, options);

            // initialize YouTube Player Modal
            if ($YouTubeModal == null) {
                $YouTubeModal = $('<div class="modal fade ' + options.cssClass + '" id="YouTubeModal" role="dialog" aria-hidden="true">');
                var modalContent = '<div class="modal-dialog" id="YouTubeModalDialog">'+
										'<div class="modal-content" id="YouTubeModalContent">'+
											'<div class="modal-header">'+
												'<button type="button" class="close" data-dismiss="modal">&times;</button>'+
												'<h4 class="modal-title" id="YouTubeModalTitle"></h4>'+
											'</div>'+
											'<div class="modal-body" id="YouTubeModalBody"></div>'+
										'</div>'+
									'</div>';
                $YouTubeModal.html(modalContent).hide().appendTo('body');
                $YouTubeModalDialog = $("#YouTubeModalDialog");
                $YouTubeModalContent = $("#YouTubeModalContent");
                $YouTubeModalTitle = $("#YouTubeModalTitle");
                $YouTubeModalBody = $("#YouTubeModalBody");
                $YouTubeModal.modal({
                    show: false
                }).on('hide.bs.modal', resetModalBody);
            }

            return this.each(function () {
                var obj = $(this);
                var data = obj.data('YouTube');
                if (!data) { //check if event is already assigned
                    obj.data('YouTube', {
                        target: obj
                    });
                    $(obj).bind('click.YouTubeModal', function () {
                        var youtubeId = options.youtubeId;
                        if ($.trim(youtubeId) == '' && obj.is("a")) {
                            youtubeId = getYouTubeIdFromUrl(obj.attr("href"));
                        }
                        if ($.trim(youtubeId) == '' || youtubeId === false) {
                            youtubeId = obj.attr(options.idAttribute);
                        }
                        var videoTitle = $.trim(options.title);
                        if (videoTitle == '') {
                            if (options.useYouTubeTitle) setYouTubeTitle(youtubeId);
                            else videoTitle = obj.attr('title');
                        }
                        if (videoTitle) {
                            setModalTitle(videoTitle);
                        }

                        resizeModal(options.width, options.height);

                        //Setup YouTube Modal
                        var YouTubeURL = getYouTubeUrl(youtubeId, options);
                        var YouTubePlayerIframe = getYouTubePlayer(YouTubeURL, options.width, options.height);
                        setModalBody(YouTubePlayerIframe);
                        $YouTubeModal.modal('show');

                        return false;
                    });
                }
            });
        },
        destroy: function () {
            return this.each(function () {
                $(this).unbind(".YouTubeModal").removeData('YouTube');
            });
        }
    };

    function setModalTitle(title) {
        $YouTubeModalTitle.html($.trim(title));
    }

    function setModalBody(content) {
        $YouTubeModalBody.html(content);
    }

    function resetModalBody() {
        setModalTitle('');
        setModalBody('');
    }

    function resizeModal(w, h) {
        $YouTubeModalContent.css({
            width: w + (margin * 2)
        });
        $YouTubeModalBody.css({
            height: h + (margin * 2),
            padding: 0
        });
        $YouTubeModalDialog.css({
            width: w + (margin * 2)
        });
    }

    function getYouTubeUrl(youtubeId, options) {
        var YouTubeURL = "//www.youtube.com/embed/" + youtubeId + "?rel=0&showsearch=0&autohide=" + options.autohide;
        YouTubeURL += "&autoplay=" + options.autoplay + "&controls=" + options.controls + "&fs=" + options.fs + "&loop=" + options.loop;
        YouTubeURL += "&showinfo=" + options.showinfo + "&color=" + options.color + "&theme=" + options.theme;
        return YouTubeURL;
    }

    function getYouTubePlayer(URL, width, height) {
        var YouTubePlayer = '<iframe title="YouTube video player" width="' + width + '" height="' + height + '" ';
        YouTubePlayer += 'style="margin:0; padding:0; box-sizing:border-box; border:0; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; margin:' + (margin - 1) + 'px;" ';<commit_msg>Firefox Bug Fix<commit_after>/*!
 * Bootstrap YouTube Popup Player Plugin
 * http://lab.abhinayrathore.com/bootstrap-youtube/
 * https://github.com/abhinayrathore/Bootstrap-Youtube-Popup-Player-Plugin
 */
(function ($) {
    var $YouTubeModal = null,
        $YouTubeModalDialog = null,
        $YouTubeModalContent = null,
        $YouTubeModalTitle = null,
        $YouTubeModalBody = null,
        margin = 5;

    //Plugin methods
    var methods = {
        //initialize plugin
        init: function (options) {
            options = $.extend({}, $.fn.YouTubeModal.defaults, options);

            // initialize YouTube Player Modal
            if ($YouTubeModal == null) {
                $YouTubeModal = $('<div class="modal fade ' + options.cssClass + '" id="YouTubeModal" role="dialog" aria-hidden="true">');
                var modalContent = '<div class="modal-dialog" id="YouTubeModalDialog">'+
										'<div class="modal-content" id="YouTubeModalContent">'+
											'<div class="modal-header">'+
												'<button type="button" class="close" data-dismiss="modal">&times;</button>'+
												'<h4 class="modal-title" id="YouTubeModalTitle"></h4>'+
											'</div>'+
											'<div class="modal-body" id="YouTubeModalBody"></div>'+
										'</div>'+
									'</div>';
                $YouTubeModal.html(modalContent).hide().appendTo('body');
                $YouTubeModalDialog = $("#YouTubeModalDialog");
                $YouTubeModalContent = $("#YouTubeModalContent");
                $YouTubeModalTitle = $("#YouTubeModalTitle");
                $YouTubeModalBody = $("#YouTubeModalBody");
                $YouTubeModal.modal({
                    show: false
                }).on('hide.bs.modal', resetModalBody);
            }

            return this.each(function () {
                var obj = $(this);
                var data = obj.data('YouTube');
                if (!data) { //check if event is already assigned
                    obj.data('YouTube', {
                        target: obj
                    });
                    $(obj).bind('click.YouTubeModal', function () {
                        var youtubeId = options.youtubeId;
                        if ($.trim(youtubeId) == '' && obj.is("a")) {
                            youtubeId = getYouTubeIdFromUrl(obj.attr("href"));
                        }
                        if ($.trim(youtubeId) == '' || youtubeId === false) {
                            youtubeId = obj.attr(options.idAttribute);
                        }
                        var videoTitle = $.trim(options.title);
                        if (videoTitle == '') {
                            if (options.useYouTubeTitle) setYouTubeTitle(youtubeId);
                            else videoTitle = obj.attr('title');
                        }
                        if (videoTitle) {
                            setModalTitle(videoTitle);
                        }

                        resizeModal(options.width, options.height);

                        //Setup YouTube Modal
                        var YouTubeURL = getYouTubeUrl(youtubeId, options);
                        var YouTubePlayerIframe = getYouTubePlayer(YouTubeURL, options.width, options.height);
                        setModalBody(YouTubePlayerIframe);
                        $YouTubeModal.modal('show');

                        return false;
                    });
                }
            });
        },
        destroy: function () {
            return this.each(function () {
                $(this).unbind(".YouTubeModal").removeData('YouTube');
            });
        }
    };

    function setModalTitle(title) {
        $YouTubeModalTitle.html($.trim(title));
    }

    function setModalBody(content) {
        $YouTubeModalBody.html(content);
    }

    function resetModalBody() {
        setModalTitle('');
        setModalBody('');
    }

    function resizeModal(w, h) {
        $YouTubeModalContent.css({
            width: w + (margin * 2)
        });
        $YouTubeModalBody.css({
            height: h + (margin * 2),
            padding: 0
        });
        $YouTubeModalDialog.css({
            width: w + (margin * 2)
        });
    }

    function getYouTubeUrl(youtubeId, options) {
        var YouTubeURL = "//www.youtube.com/embed/" + youtubeId + "?rel=0&showsearch=0&autohide=" + options.autohide;
        YouTubeURL += "&autoplay=" + options.autoplay + "&controls=" + options.controls + "&fs=" + options.fs + "&loop=" + options.loop;
        YouTubeURL += "&showinfo=" + options.showinfo + "&color=" + options.color + "&theme=" + options.theme;
        YouTubeURL += "&wmode=transparent"; // Firefox Bug Fix
        return YouTubeURL;
    }

    function getYouTubePlayer(URL, width, height) {
        var YouTubePlayer = '<iframe title="YouTube video player" width="' + width + '" height="' + height + '" ';
        YouTubePlayer += 'style="margin:0; padding:0; box-sizing:border-box; border:0; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; margin:' + (margin - 1) + 'px;" ';
{'fraction_non_alphanumeric': 0.14124962984897838, 'fraction_numerical': 0.0031586220511301945, 'mean_word_length': 1.6747624076029568, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 29, 'https://': 2, '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': '4407386', 'n_tokens_mistral': 2918, 'n_tokens_neox': 2628, 'n_words': 491}