Created
September 9, 2016 16:09
-
-
Save kolyuchiy/3a3536a6973712cae724bc34bc56bc25 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Почта mail.ru | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description try to take over the world! | |
// @author You | |
// @match https://e.mail.ru/* | |
// @grant none | |
// @require http://code.jquery.com/jquery-latest.js | |
// ==/UserScript== | |
(function() { | |
'use strict'; | |
// http://www.appelsiini.net/projects/viewport | |
(function($){$.belowthefold=function(element,settings){var fold=$(window).height()+$(window).scrollTop();return fold<=$(element).offset().top-settings.threshold;};$.abovethetop=function(element,settings){var top=$(window).scrollTop();return top>=$(element).offset().top+$(element).height()-settings.threshold;};$.rightofscreen=function(element,settings){var fold=$(window).width()+$(window).scrollLeft();return fold<=$(element).offset().left-settings.threshold;};$.leftofscreen=function(element,settings){var left=$(window).scrollLeft();return left>=$(element).offset().left+$(element).width()-settings.threshold;};$.inviewport=function(element,settings){return!$.rightofscreen(element,settings)&&!$.leftofscreen(element,settings)&&!$.belowthefold(element,settings)&&!$.abovethetop(element,settings);};$.extend($.expr[':'],{"below-the-fold":function(a,i,m){return $.belowthefold(a,{threshold:0});},"above-the-top":function(a,i,m){return $.abovethetop(a,{threshold:0});},"left-of-screen":function(a,i,m){return $.leftofscreen(a,{threshold:0});},"right-of-screen":function(a,i,m){return $.rightofscreen(a,{threshold:0});},"in-viewport":function(a,i,m){return $.inviewport(a,{threshold:0});}});})(jQuery); | |
$.noConflict(); | |
jQuery(document).ready(function($) { | |
$(document).keydown(function (e) { | |
//alert(e.which); | |
if (e.which == 68) { // d | |
if ($('#b-thread:visible').length > 0) { | |
var more = $('[data-mnemo="letter"].b-letter_expanded [data-group="more"]:in-viewport:first'); | |
more.find('.js-preload-click').click(); | |
more.find('[data-name="remove"]').click(); | |
} | |
else if ($('#b-letters:visible').length > 0) { | |
$('.b-toolbar .b-checkbox').click(); | |
$('.b-toolbar [data-name=remove]').click(); | |
} | |
} | |
}); | |
}); | |
// Your code here... | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment