Greasy Fork is available in English.

Modify RES Image Title

Sets the title attribute on the RES Image in a Reddit thread to match the document title. This is done so extensions like Pinterest can capture the image and use the document's title as the description.

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

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

θα χρειαστεί να εγκαταστήσετε μια επέκταση όπως το 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         Modify RES Image Title
// @namespace    http://tampermonkey.net/
// @version      2.0
// @description  Sets the title attribute on the RES Image in a Reddit thread to match the document title. This is done so extensions like Pinterest can capture the image and use the document's title as the description.
// @author       PoorPolonius
// @include      http://www.reddit.com/r/*
// @include      https://www.reddit.com/r/*
// @match        http://www.reddit.com/r/*
// @match        https://www.reddit.com/r/*
// @grant        GM_log
// @require      https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js
// @license      Copyright 2016 reddit.com/u/PoorPolonius; Released under the MIT license
// ==/UserScript==
/* jshint -W097 */
'use strict';

// Your code here...

var COUNTER_LIMIT = 5;

var _siteTable = "#siteTable",
    _toggleButton = "a[class*='toggleImage']",
    _resImage = "img[class*='RESImage']";

var _buttonCounter = 0,
    _imageCounter = 0;

var _handlerAttached = false,
    _delayTimer = null;

function ClearTimeout() {
    
    if (null !== _delayTimer) {
        
        clearTimeout(_delayTimer);
    }
}

function ToggleHandler(e) {

    ClearTimeout();
    
    var resImage = $(_resImage);

    if (0 < resImage.length) {

        $(_resImage).attr("title", document.title);
        
        DetachToggleHandler();
    }
    else if (COUNTER_LIMIT !== _imageCounter) {
        
        _delayTimer = setTimeout(ToggleHandler, 100);
    }
    else {
        
        DetachToggleHandler();
    }
    
    _imageCounter++;
}

function AttachToggleHandler() {

    ClearTimeout();
    
    var toggleButton = $(_toggleButton);
    
    if (!_handlerAttached && 0 < toggleButton.length) {
        
        toggleButton.on("click", ToggleHandler);
        
        _handlerAttached = true;
    }
    else if (COUNTER_LIMIT !== _buttonCounter) {
        
        _delayTimer = setTimeout(AttachToggleHandler, 100);
    }
    
    _buttonCounter++;
}

function DetachToggleHandler() {
    
    $(_toggleButton).off("click", ToggleHandler);
}

$(document).ready(function () {

    AttachToggleHandler();
});