Custom reddit top posts

custom reddit top posts

目前為 2016-05-19 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

You will need to install an extension such as Tampermonkey to install this script.

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name        Custom reddit top posts
// @namespace   http://hayageek.com
// @include 	https://*.reddit.com/r/*/top/*
// @require     http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js
// @version     1.01
// @description custom reddit top posts
// ==/UserScript==

$( ".drop-choices" ).append("<div class='custom'>custom</div>");

$( ".drop-choices" ).append('<div class="calendar" style="display: none;"> <fieldset>\
  From: <input type="text" id="input_from">\
</fieldset>\
<fieldset>\
  To:   <input type="text" id="input_to">\
</fieldset>');

    $(document).ready(function() {
        $('.custom').mouseover(function() {
                $('.calendar').slideToggle("fast");
        });
    });

var from_$input = $('#input_from').pickadate(),
    from_picker = from_$input.pickadate('picker');

var to_$input = $('#input_to').pickadate(),
    to_picker = to_$input.pickadate('picker');


// Check if there’s a “from” or “to” date to start with.
if ( from_picker.get('value') ) {
  to_picker.set('min', from_picker.get('select'));
}
if ( to_picker.get('value') ) {
  from_picker.set('max', to_picker.get('select'));
}

// When something is selected, update the “from” and “to” limits.
from_picker.on('set', function(event) {
  if ( event.select ) {
    to_picker.set('min', from_picker.get('select'));
  }
  else if ( 'clear' in event ) {
    to_picker.set('min', false);
  }
});
to_picker.on('set', function(event) {
  if ( event.select ) {
    from_picker.set('max', to_picker.get('select'));
  }
  else if ( 'clear' in event ) {
    from_picker.set('max', false);
  }
});