Pluspora Unread Notifications

Opens the notification page with unread messages only. Optionally modifies the link on the bell icon to open the notifications page directly.

이 스크립트를 설치하려면 Tampermonkey, Greasemonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램을 설치해야 합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Violentmonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey 또는 Userscripts와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 Tampermonkey와 같은 확장 프로그램이 필요합니다.

이 스크립트를 설치하려면 유저 스크립트 관리자 확장 프로그램이 필요합니다.

(이미 유저 스크립트 관리자가 설치되어 있습니다. 설치를 진행합니다!)

Advertisement:

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 Stylus와 같은 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

이 스타일을 설치하려면 유저 스타일 관리자 확장 프로그램이 필요합니다.

(이미 유저 스타일 관리자가 설치되어 있습니다. 설치를 진행합니다!)

Advertisement:

// ==UserScript==
// @name         Pluspora Unread Notifications
// @namespace    http://aperturized.com
// @version      0.2.2
// @description  Opens the notification page with unread messages only. Optionally modifies the link on the bell icon to open the notifications page directly.
// @author       carsten.schlipf(at)aperturized.com
// @match        https://pluspora.com/*
// @match        https://*.pluspora.com/**
// @match        https://joindiaspora.org/*
// @match        https://*.joindiaspora.org/**
// @match        https://deko.cloud/**
// @match        https://despora.de/*
// @match        https://*.despora.de/**
// @grant        none
// ==/UserScript==

// Set to false to disable login on the browser console.
const LOG_ENABLED=true;

// Set to true to always open the notifications in a new page instead of a popup.
const ALWAYS_NEW_PAGE=false;


function logMsg(message) {
    if (! LOG_ENABLED)
    {
        return;
    }
    console.log ("[pluspora.notification_page] " + message);
}

(function() {
    'use strict';
    logMsg ("Running Pluspora Notification Page Tampermonkey script.");

    var notificationsLink = document.getElementById("notifications-link");
    if (! notificationsLink ) {
        logMsg("Element notifications-link not found. Exiting.");
        return;
    }

    // Modify URL to open unread elements only
    notificationsLink.setAttribute("href", notificationsLink.getAttribute("href") + "?show=unread");
    logMsg("Modified link to open unread messages only.");

    // Modify View all
    var viewAllElements = document.getElementsByClassName("view_all");
    if (viewAllElements.length == 0 ) {
        logMsg("No elements with the class view_all found.")
    }
    for (var i = 0; i < viewAllElements.length; i++) {
        var viewAllElement = viewAllElements[i];
        var linkElement = viewAllElement.getElementsByTagName('a')[0];
        linkElement.setAttribute("href", linkElement.getAttribute("href") + "?show=unread");
        linkElement.textContent = "View all unread";
    }

    // Modify link to open page directly
    if (ALWAYS_NEW_PAGE) {
        notificationsLink.setAttribute("id", "notifications-link-modified");
        notificationsLink.removeAttribute("data-toggle");
        logMsg("Modified link to open notification page instead.");
    }
})();