Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name Arhivach Image Options
- // @version 0.1
- // @description Adds direct download button and reverse image search options
- // @author Π΅ΠΌΡ
- // @match https://arhivach.cf/thread/*
- // @require https://code.jquery.com/jquery-3.2.1.min.js
- // @require https://use.fontawesome.com/releases/v5.0.10/js/all.js
- // ==/UserScript==
- this.$ = this.jQuery = jQuery.noConflict(true);
- function getReverseImageSearchOptions(url)
- {
- var options = {
- 'google': 'https://www.google.com/searchbyimage?image_url=' + url + '&safe=off',
- 'yandex': 'https://www.yandex.com/images/search?rpt=imageview&img_url=' + url,
- 'iqdb': 'https://iqdb.org/?url=' + url
- };
- return options;
- }
- var re = new RegExp('(mp4|webm)');
- $(document).ready(function(){
- var use_style = 'text-decoration: none; margin-left: 5px; font-size: 10px;';
- $(".post_image_block").each(function(index)
- {
- var file_url = $(this).find('.img_filename');
- if(file_url != undefined) {
- $reverse_options = getReverseImageSearchOptions(file_url.attr('href'));
- if(re.test(file_url.attr('href')))
- {
- $reverse_options = getReverseImageSearchOptions($(this).find('.post_image > img').attr('src'));
- }
- var first_c = $(this).find(">:first-child");
- var direct_download = '<a style="' + use_style + '" href="' + file_url.attr('href') + '" download="' + file_url.text() + '"><i title="Download: ' + file_url.text() + '" class="fa fa-download"></i></a>';
- var r_google = '<a style="' + use_style + '" target="_blank" href="' + $reverse_options['google'] + '"><i title="Google" class="fab fa-google"></i></a>';
- var r_yandex = '<a style="' + use_style + '" target="_blank" href="' + $reverse_options['yandex'] + '"><i title="Yandex" class="fab fa-yandex-international"></i></a>';
- first_c.after(direct_download + r_google + r_yandex);
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement