Facebook Double

Adds doubles to Facebook

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

You will need to install a user script manager extension 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.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name          Facebook Double
// @author        Niqueish (edited by noisy cat)
// @description   Adds doubles to Facebook
// @homepage      https://www.facebook.com/Niqueish
// @version       1.0n
// @include       *://*.facebook.com/*
// @grant         none
// @require       http://code.jquery.com/jquery-2.2.1.min.js
// @require https://greasyfork.org/scripts/20860-arrive-upload/code/arrive-upload.js?version=133295
// @namespace https://greasyfork.org/users/31125
// ==/UserScript==


function doubleHighlight(str)
{
    var Fletter = str.substr(0, 1);
    return (str.replace(new RegExp(Fletter, 'g'), "").length === 0);
}

//HEX
var highlightColour = "#ffe";

function fillPost(element)
{
    console.log(element);
    if (element.hasClass("postid"))
        return;

    element.addClass("postid");

    var post = element.find('a._5pcq').attr("href");
    var post_id = post.match(/(?:permalink|posts|videos|(?:photos\/.*\/))\/([0-9]*)/);
    if (!post_id)
        return;
    post_id = post_id[1];
    var container = element.find('a._5pcq').first().parent();
    console.log(container);
    container.append('<span> · </span><span class="post_id">No. '+post_id+'</span>');
}

function fillComment(element)
{
    if (element.hasClass("postid"))
        return;

    element.addClass("postid");

    var post = element.find('a.uiLinkSubtle').attr("href");
    var post_id = post.match(/comment_id=([0-9]*)&comment_tracking/)[1];

    element.find('a.uiLinkSubtle').parent().append('<span> · </span><span class="post_id">No. '+post_id+'</span>');
}

$("body").arrive(".userContentWrapper:not(.postid)", {fireOnAttributesModification: true, existing: true}, function() { fillPost($(this)); });
$("body").arrive(".UFICommentContentBlock:not(.postid)", {fireOnAttributesModification: true, existing: true}, function() { fillComment($(this)); });