<commit_before>// ==UserScript==
// @name        yt-looper
// @description Adds a button on YouTube, Imgur and SoundCloud to open current resource in yt.aergia.eu looper
// @namespace   https://yt.aergia.eu
// @icon        https://i.imgur.com/EGgL1nx.png
// @include     https://www.youtube.com/*
// @include     https://youtube.com/*
// @include     http://www.youtube.com/*
// @include     http://youtube.com/*
// @include     https://imgur.com/*
// @include     http://imgur.com/*
// @include     http://soundcloud.com/*
// @include     https://soundcloud.com/*
// @version     1.7.3
// @updateURL   https://yt.aergia.eu/yt-looper.user.js
// @downloadURL https://yt.aergia.eu/yt-looper.user.js
// @require     https://cdn.jsdelivr.net/jquery/3.1.1/jquery.min.js
// @grant       none
// @noframes
// ==/UserScript==
(function ($, undefined) { // eslint-disable-line no-unused-vars
  'use strict';
  var youtubeHandler = function () {
    var atWatchPage = window.location.pathname.startsWith('/watch');
    if (atWatchPage && $('#yt-looper').length === 0) {
      var humanize = function (sec) {
        var sec_num = parseInt(sec, 10);
        var hours = Math.floor(sec_num / 3600);
        var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
        var seconds = sec_num - (hours * 3600) - (minutes * 60);
        hours = hours > 0 ? (hours + 'h')  : '';
        minutes = minutes > 0 ? (minutes + 'm')  : '';
        seconds = seconds > 0 ? (seconds + 's')  : '';
        return sec === 0 ? '0s' : hours + minutes + seconds;
      };
      var getYtPlayer = function () {
        var doc = window.document;
        var ytplayer = doc.getElementById('movie_player') || doc.getElementById('movie_player-flash');
        return ytplayer;
      };
      var renderLooperActions = function() {
        $('#yt-looper-start').remove();
        $('#yt-looper-end').remove();
        $('#yt-looper').remove();
        $('#yt-looper-interval').remove();
        var $button = $('<button id="yt-looper" class="yt-uix-button yt-uix-button-opacity yt-uix-button-has-icon yt-uix-tooltip" title="Open in yt-looper"><span style="margin:0 0.1em;font-size:2.25em;vertical-align: middle;">&#x21BB;</span> yt.aergia.eu </button>').hide();
        var $intervals = $('<span id="yt-looper-interval"></span>').hide();
        var input = '<input class="yt-uix-form-input-text title-input" style="width:50px!important;margin-right:0.25em;" />';
        var $secondaryActions = $('div.watch-action-buttons > div.watch-secondary-actions');
        var start = humanize(0);
        var end = humanize(getYtPlayer().getDuration());
        var $start = $(input).attr('id', 'yt-looper-start').val(start).attr('title', 'Start of loop');
        var $end = $(input).attr('id', 'yt-looper-end').val(end).attr('title', 'End of loop');
        $secondaryActions.prepend($button);
        if (!/list=/.test(window.location.href)) { // disable start/end picker when in playlist mode (did not work correct anyway)
          $intervals.append($start).append($end).insertBefore($button);
        }
        $button.show();
        $button.click(function () {
          var url = window.location.href;
          url = url.replace(/.*youtube.com\/watch\?/, 'https://yt.aergia.eu/#');
          if (getYtPlayer().getPlayerState() === 2) {
            url = url.replace(/[&#]t=[^&#]*/g, '');
            url = url + '#t=' + $('#yt-looper-start').val() + ';' + $('#yt-looper-end').val();
          }
          window.open(url);
        });
      };<commit_msg>userscript: strip timestamp when in playlist mode<commit_after>// ==UserScript==
// @name        yt-looper
// @description Adds a button on YouTube, Imgur and SoundCloud to open current resource in yt.aergia.eu looper
// @namespace   https://yt.aergia.eu
// @icon        https://i.imgur.com/EGgL1nx.png
// @include     https://www.youtube.com/*
// @include     https://youtube.com/*
// @include     http://www.youtube.com/*
// @include     http://youtube.com/*
// @include     https://imgur.com/*
// @include     http://imgur.com/*
// @include     http://soundcloud.com/*
// @include     https://soundcloud.com/*
// @version     1.7.4
// @updateURL   https://yt.aergia.eu/yt-looper.user.js
// @downloadURL https://yt.aergia.eu/yt-looper.user.js
// @require     https://cdn.jsdelivr.net/jquery/3.1.1/jquery.min.js
// @grant       none
// @noframes
// ==/UserScript==
(function ($, undefined) { // eslint-disable-line no-unused-vars
  'use strict';
  var youtubeHandler = function () {
    var atWatchPage = window.location.pathname.startsWith('/watch');
    if (atWatchPage && $('#yt-looper').length === 0) {
      var humanize = function (sec) {
        var sec_num = parseInt(sec, 10);
        var hours = Math.floor(sec_num / 3600);
        var minutes = Math.floor((sec_num - (hours * 3600)) / 60);
        var seconds = sec_num - (hours * 3600) - (minutes * 60);
        hours = hours > 0 ? (hours + 'h')  : '';
        minutes = minutes > 0 ? (minutes + 'm')  : '';
        seconds = seconds > 0 ? (seconds + 's')  : '';
        return sec === 0 ? '0s' : hours + minutes + seconds;
      };
      var getYtPlayer = function () {
        var doc = window.document;
        var ytplayer = doc.getElementById('movie_player') || doc.getElementById('movie_player-flash');
        return ytplayer;
      };
      var playlistMode = function () {
        return /list=/.test(window.location.href);
      };
      var renderLooperActions = function() {
        $('#yt-looper-start').remove();
        $('#yt-looper-end').remove();
        $('#yt-looper').remove();
        $('#yt-looper-interval').remove();
        var $button = $('<button id="yt-looper" class="yt-uix-button yt-uix-button-opacity yt-uix-button-has-icon yt-uix-tooltip" title="Open in yt-looper"><span style="margin:0 0.1em;font-size:2.25em;vertical-align: middle;">&#x21BB;</span> yt.aergia.eu </button>').hide();
        var $intervals = $('<span id="yt-looper-interval"></span>').hide();
        var input = '<input class="yt-uix-form-input-text title-input" style="width:50px!important;margin-right:0.25em;" />';
        var $secondaryActions = $('div.watch-action-buttons > div.watch-secondary-actions');
        var start = humanize(0);
        var end = humanize(getYtPlayer().getDuration());
        var $start = $(input).attr('id', 'yt-looper-start').val(start).attr('title', 'Start of loop');
        var $end = $(input).attr('id', 'yt-looper-end').val(end).attr('title', 'End of loop');
        $secondaryActions.prepend($button);
        if (!playlistMode()) { // disable start/end picker when in playlist mode (did not work correct anyway)
          $intervals.append($start).append($end).insertBefore($button);
        }
        $button.show();
        $button.click(function () {
          var url = window.location.href;
          url = url.replace(/.*youtube.com\/watch\?/, 'https://yt.aergia.eu/#');
          if (playlistMode()) {
              url = url.replace(/[&#]t=[^&#]*/g, '');
          } else if (getYtPlayer().getPlayerState() === 2) {
              url = url.replace(/[&#]t=[^&#]*/g, '');
              url = url + '#t=' + $('#yt-looper-start').val() + ';' + $('#yt-looper-end').val();
          }
          window.open(url);
        });
      };
{'fraction_non_alphanumeric': 0.20233837689133424, 'fraction_numerical': 0.01265474552957359, 'mean_word_length': 2.51256038647343, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 25, 'https://': 20, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5171552', 'n_tokens_mistral': 2418, 'n_tokens_neox': 2349, 'n_words': 454}