Skip to content

Instantly share code, notes, and snippets.

@nobane
Last active August 31, 2020 21:44
Show Gist options
  • Save nobane/d7077855b37b8738d3bce8d99dea04fe to your computer and use it in GitHub Desktop.
Save nobane/d7077855b37b8738d3bce8d99dea04fe to your computer and use it in GitHub Desktop.
Post preview button
// ==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);
})
})
@kilimar
Copy link

kilimar commented Aug 31, 2020

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...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment