Last active
August 31, 2020 21:44
-
-
Save nobane/d7077855b37b8738d3bce8d99dea04fe to your computer and use it in GitHub Desktop.
Post preview button
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name craigslist | |
// @namespace craigslist | |
// @include https://*.craigslist.org* | |
// @version 1 | |
// @grant none | |
// ==/UserScript== | |
var popup = $('<div>').css({ | |
height: 400, | |
background: 'white' | |
}); | |
var iframe = $('<iframe>').appendTo(popup).css({ | |
height: '100%', | |
width: '100%' | |
}); | |
$('.result-meta').each(function() { | |
$(this).append('<span>P</span>').click(function() { | |
var row = $(this).parents('.result-row'); | |
if (row.find('iframe').length > 0) { | |
return popup.remove(); | |
} | |
var url = row.find('.result-title.hdrlnk').attr('href'); | |
row.css({position: 'relative', overflow: 'visible', 'max-height': 'none'}); | |
iframe.attr('src', url); | |
row.append(popup); | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can you modify that so that it works in gallery mode? As is, in gallery mode, it opens a tiny which doesn't even pop on top of the other gallery pictures...