Commit e2e18af 1 parent 05f4464 commit e2e18af Copy full SHA for e2e18af
File tree 3 files changed +45
-4
lines changed
3 files changed +45
-4
lines changed Original file line number Diff line number Diff line change @@ -1374,10 +1374,13 @@ var LinkSummary = (function () {
1374
1374
if ( youTubeID ) {
1375
1375
summaryHTML += "<a class=\"preview-container blck\" \n\t\t\t\t\t\t\t\thref=\"" + linkURL + "\" \n\t\t\t\t\t\t\t\ttarget=\"_blank\">\n\t\t\t\t\t\t <img class=\"video-preview\" \n\t\t\t\t\t\t src=\"//img.youtube.com/vi/" + youTubeID + "/hqdefault.jpg\"/>\n\t\t\t\t\t\t </a>" ;
1376
1376
} else {
1377
- // if it's a Gfycat link
1377
+ // if it's a Gfycat or RedGifs link
1378
1378
var gfycatID = getGfycatIDfromURL ( linkURL ) ;
1379
+ var redGifsID = getRedGifsIDfromURL ( linkURL ) ;
1379
1380
if ( gfycatID ) {
1380
1381
summaryHTML += "<div style='position:relative; padding-bottom:56.69%'>" + "<iframe src='https://gfycat.com/ifr/" + gfycatID + "' frameborder='0' scrolling='no' width='100%' height='100%' style='position:absolute;top:0;left:0;' allowfullscreen></iframe>" + "</div>" ;
1382
+ } else if ( redGifsID ) {
1383
+ summaryHTML += "<div style='position:relative; padding-bottom:56.69%'>" + "<iframe src='https://redgifs.com/ifr/" + redGifsID + "' frameborder='0' scrolling='no' width='100%' height='100%' style='position:absolute;top:0;left:0;' allowfullscreen></iframe>" + "</div>" ;
1381
1384
}
1382
1385
}
1383
1386
}
@@ -1459,6 +1462,22 @@ var LinkSummary = (function () {
1459
1462
}
1460
1463
} ;
1461
1464
1465
+ var getRedGifsIDfromURL = function getRedGifsIDfromURL ( url ) {
1466
+ console . log ( url ) ;
1467
+ var matching = url . match ( / r e d g i f s .c o m \/ (?: (?: i f r | w a t c h ) \/ ) ( \w + ) / i) ;
1468
+ console . log ( matching ) ;
1469
+ if ( ! matching ) {
1470
+ return '' ;
1471
+ } else {
1472
+ if ( matching && matching . length > 1 ) {
1473
+ console . log ( matching [ 1 ] ) ;
1474
+ return matching [ 1 ] ;
1475
+ } else {
1476
+ return null ;
1477
+ }
1478
+ }
1479
+ } ;
1480
+
1462
1481
var initListeners = function initListeners ( ) {
1463
1482
UI . el . detailWrap . on ( 'click' , '.js-img-preview' , function ( ev ) {
1464
1483
ev . preventDefault ( ) ;
You can’t perform that action at this time.
0 commit comments