Custom reddit top posts

custom reddit top posts

Από την 19/05/2016. Δείτε την τελευταία έκδοση.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey, το Greasemonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Violentmonkey για να εγκαταστήσετε αυτόν τον κώδικα.

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το Tampermonkey ή το Userscripts για να εγκαταστήσετε αυτόν τον κώδικα.

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

Θα χρειαστεί να εγκαταστήσετε μια επέκταση διαχείρισης κώδικα χρήστη για να εγκαταστήσετε αυτόν τον κώδικα.

(Έχω ήδη έναν διαχειριστή κώδικα χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Έχω ήδη έναν διαχειριστή στυλ χρήστη, επιτρέψτε μου να τον εγκαταστήσω!)

// ==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);
  }
});