// ==UserScript==
// @name Fitgirl [ Youtube Preview ]
// @namespace https://greasyfork.org/en/users/10118-drhouse
// @version 2.3
// @description adds YouTube Preview and Review links below video game titles, easily watch a video or review of the game before playing it
// @include https://fitgirl-repacks.site/*
// @include https://duckduckgo.com/*
// @require http://code.jquery.com/jquery-3.4.1.min.js
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.18.2/babel.js
// @require https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.16.0/polyfill.js
// @author drhouse
// @license CC-BY-NC-SA-4.0
// @icon https://www.google.com/s2/favicons?sz=64&domain=fitgirl-repacks.site
// @downloadURL https://update.greasyfork.icu/scripts/468693/Fitgirl%20%5B%20Youtube%20Preview%20%5D.user.js
// @updateURL https://update.greasyfork.icu/scripts/468693/Fitgirl%20%5B%20Youtube%20Preview%20%5D.meta.js
// ==/UserScript==
/* global jQuery, $ */
this.$ = this.jQuery = jQuery.noConflict(true);
(function($){
function videoize(){
$('.nframe').remove()
$('br').remove()
$('article').each(function(index, value) {
var x = $(this).find('.entry-title')
var x2 = $(x).text()
var regex1 = /^(.*?)(?=\s+–)/;
var regex2 = /^(.*?)(?=\s+\+)/;
var result = x2.match(regex1);
if(result === null){
result = x2.match(regex2);
if(result === null){
console.log('result1='+result)
var x3 = encodeURIComponent(x2)
} else {
result = result[1];
console.log('result2='+result)
x3 = encodeURIComponent(result)
}
} else {
result = result[1];
console.log('result3='+result)
x3 = encodeURIComponent(result)
}
$('
').insertAfter(x)
var urlish = 'https://duckduckgo.com/?hps=1&q=%21+site%3Ayoutube.com+' + x3 + '+gameplay+video+game'
$('