Skip to content

Instantly share code, notes, and snippets.

@unt0uchable
Last active June 23, 2016 02:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unt0uchable/46c5e0857f99c64871205b2e1c14fe7e to your computer and use it in GitHub Desktop.
Save unt0uchable/46c5e0857f99c64871205b2e1c14fe7e to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name dev_reddit_timeframe
// @namespace2 unt0uchable
// @description Display buttons for different timeframes on subreddit top page
// @author unt0uchable
// @include *reddit.com/top/*
// @include *reddit.com/r/*/top/*
// @include *reddit.com/me/m/*/top/*
// @version 1
// @grant GM_config
// @grant GM_xmlhttpRequest
// @grant GM_getResourceURL
// @grant GM_getValue
// @grant GM_setValue
// @grant GM_registerMenuCommand
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @require https://greasyfork.org/libraries/GM_config/20131122/GM_config.js
// ==/UserScript==
/*
Other includes:
// @include *reddit.com/user/*sort=top*
*/
this.$ = this.jQuery = jQuery.noConflict(true);
try {
$('.menuarea .dropdown-title').contents().eq(0).replaceWith('Time: ');
$('.menuarea .dropdown').css({'margin-right':'30px'});
// $('.menuarea .dropdown').attr('onmouseover','open_menu(this)');
// $('.menuarea .drop-choices').attr('onmouseover','open_menu(this)');
// $('.menuarea .drop-choices').attr('onmouseout','close_menu(this)');
// $('.menuarea .dropdown').attr('hover','open_menu(this)');
// $('.menuarea .dropdown').attr('hover','open_menu(this)','close_menus(this)');
$('.menuarea .drop-choices .choice').text(function () {
return $(this).text().replace('this ', '');
});
$('.menuarea .drop-choices .choice').text(function () {
return $(this).text().replace(' time', '');
});
$('.menuarea .selected').text(function () {
return $(this).text().replace('this ', '');
});
$('.menuarea .selected').text(function () {
return $(this).text().replace(' time', '');
});
$('.drop-choices form').each(function () {
$('.menuarea .spacer').append($(this).clone().css({'display':'inline','margin-right':'15px'}));
});
} catch (err) {
alert(err.toString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment