您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Michał Białek znowu zepsuł mirko (⌐ ͡■ ͜ʖ ͡■) Wykop XS służy do wspomagania działania stylu "Wykop X", który jest wymagany do poprawnego działania niniejszego skryptu. Wykop X zainstaluj stąd: https://userstyles.world/style/8174/wykop-x
当前为
// ==UserScript== // @name Wykop XS dla Wykop.pl // @version 2.6.5 // @author SebastianDosiadłgo <[email protected]> // @author xXdeepfriedXx: "getObserveCount", "getTagsFingerPrint", "newAutoCompleteWindowAdded" - xXdeepfriedXx napisał funkcje pobierające z API wykopu liczbę obserwujących tagi podczas ich wpisywania! Podziękowania, za uzyczenie kodu. // @namespace Violentmonkey Scripts // @match https://wykop.pl/* // @require https://unpkg.com/xhook@latest/dist/xhook.min.js // @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js // @require https://gf.qytechs.cn/scripts/383527-wait-for-key-elements/code/Wait_for_key_elements.js?version=701631 // @require https://gf.qytechs.cn/scripts/458629-depaginator-for-wykop-pl/code/Depaginator%20for%20Wykoppl.user.js // @grant none // @license // @description Michał Białek znowu zepsuł mirko (⌐ ͡■ ͜ʖ ͡■) Wykop XS służy do wspomagania działania stylu "Wykop X", który jest wymagany do poprawnego działania niniejszego skryptu. Wykop X zainstaluj stąd: https://userstyles.world/style/8174/wykop-x // ==/UserScript== const currentVersion = "2.6.5"; function categoryRedirectToMicroblogButton() { $(`section.links div.content ul li`).each(function( index ) { let href = $(this).children("a").attr("href"); let microblogButtonHtml = `<a class="wykopxs wykopx_categories_microblog_a" href="${ href }/mikroblog">M</a>`; $(this).append(microblogButtonHtml); }); } /* add micro button on left menu open, 2 versions*/ $(`header.header > div.left > button`).on("click", function(){ //categoryRedirectToMicroblogButton(); }); waitForKeyElements("aside.left-panel", categoryRedirectToMicroblogButton); const adjacentCode = ` <style> /* wykop x promo ON */ .wykopx_promo { width: 100%; display: block!important; height: 300px!important; background: url('https://raw.githubusercontent.com/wykopx/WykopX/main/promo-images/wykopx-install-sidebar-day.png'); } [data-night-mode] .wykopx_promo { background: url('https://raw.githubusercontent.com/wykopx/WykopX/main/promo-images/wykopx-install-sidebar-night.png'); } /* hide wykopxs features if wykopx is not installed */ .wykopxs { display: none; } /* wykopxs-promo OFF */ section.inline-autocomplete section.inline-autocomplete-stream div.content:after, body div.main-content section > section.sidebar:after { display: none!important; } /* wykopxs new version available */ body > section > section.wykopxs_new_version { display: flex; align-items: center;border-bottom: 1px solid rgba(128, 128, 128, 0.2);color: rgba(128, 128, 128, 1); padding: 8px 20px; font-size: 14px; } section.wykopxs_new_version a{display: inline-block;background: rgb(0,85,0);color: white;display: inline-block;background-color: #005200;padding: .3em 0.7em;margin: 0 10px;} section.wykopxs_new_version a:hover { background: rgba(0,85,0, 0.7); text-decoration: none!important; } section.wykopxs_new_version span { opacity: 0.6; margin-left: auto; } </style>`; document.head.insertAdjacentHTML('beforeend', adjacentCode); $.get(`https://raw.githubusercontent.com/wykopx/WykopX/main/old-versions/wykopxs.${ currentVersion }.gif`).done(function() { addWykopXSNewVersionAvailableToast(); // new version available }).fail(function() {}) function hideWykopXSPromo() { $(`body div.main-content section > section.sidebar:after`).css("display: none!important;"); } function addWykopXPromo() { let wykopxpromo = `<section class="wykopx_promo"></section>`; $(wykopxpromo).insertBefore(`section.sidebar > footer`); } function addWykopXSNewVersionAvailableToast() { let wykopxsnewversionavailabletoast = `<section class="wykopxs_new_version">Dostępna jest nowa wersja skryptu Wykop XS. <a href="https://bit.ly/wykopxs_update_available" target="_blank" style="color: #fff!important;">Zaktualizuj Wykop XS</a> do najnowszej wersji <span>Twoja wersja Wykop XS to v.${ currentVersion }</span></section>`; $(wykopxsnewversionavailabletoast).insertAfter(`header.header`); } function runWithDelay(f, time) { setTimeout(function(){ f() }, time); } const unreadNotifications = { tags: 0, tags_new_entry_with_observed_tag: 0, tags_new_link_with_observed_tag: 0, entries: 0, pm: 0, total: 0 }; function countNumberOfNotificationsOnDesktop() { $("header .right ul li.dropdown").removeClass("unread_5").removeClass("unread_4").removeClass("unread_3").removeClass("unread_2").removeClass("unread_1"); $("header .right ul li.dropdown:has(a.new)" ).each(function(index, value) { const lastWord = $(this).attr("class").split(" ").pop(); let numberOfNotifications = 0; // liczba powiadomień o tagach / wołaniach $(this).find(".notify:not(.read)" ).each(function(index, value) { ++numberOfNotifications; $(this).addClass(`unread_${numberOfNotifications}`); if(lastWord == "tags") { unreadNotifications["tags"]++; if($(this).find(`div.content p.new-entry-with-observed-tag`).length > 0) { unreadNotifications["tags_new_entry_with_observed_tag"]++; } else if($(this).find(`div.content p.new-link-with-observed-tag`).length > 0) { unreadNotifications["tags_new_link_with_observed_tag"]++; } } else if(lastWord == "entries") { unreadNotifications["entries"]++; } }).parents(`.notifications.dropdown`).addClass(`unread_${numberOfNotifications}`); }) if(unreadNotifications["tags"] > 0) { console.log(`Wykop X || Liczba nowych powiadomień z obserwowanych tagów: ${ unreadNotifications["tags"] } (w tym ${ unreadNotifications["tags_new_entry_with_observed_tag"] } z wpisów i ${ unreadNotifications["tags_new_link_with_observed_tag"] } ze znalezisk)`); } if(unreadNotifications["entries"] > 0) { console.log(`Wykop X || Liczba nowych zawołań: ${ unreadNotifications["entries"] }`); } $("header .right ul li.pm.dropdown:has(a.new)" ).each(function(index, value) { let numberOfNotifications = 0; // liczba powiadomień o wiadomościach PM $(this).find(".item.unread" ).each(function(index, value) { ++numberOfNotifications; ++unreadNotifications["total"]; $(this).addClass(`unread_${numberOfNotifications}`); }).parents(`.pm.dropdown`).addClass(`unread_${numberOfNotifications}`); unreadNotifications["pm"] = numberOfNotifications; console.log(`Wykop X || Liczba nowych wiadomości: ${unreadNotifications["pm"]}`); }) if(unreadNotifications.tags > 0) { createNewProfileDropdownMenuItem(`Powiadomienia z #tagów: (${ unreadNotifications.tags})`, "Masz nowe powiadomienia z obserwowanych #tagów", "wykopx_notifications_tags", "/powiadomienia/tagi", "_self", null, unreadNotifications.tags); } if(unreadNotifications.entries > 0) { createNewProfileDropdownMenuItem(`Zawołania w komentarzach: (${ unreadNotifications.entries})`, "Zawołano Cię w komentarzu", "wykopx_notifications_entries", "/powiadomienia/moje", "_self", null, unreadNotifications.entries); } if(unreadNotifications.pm > 0) { createNewProfileDropdownMenuItem(`Nowe wiadomości: (${ unreadNotifications.pm})`, "Masz nowe, nieprzeczytane wiadomości prywatne", "wykopx_notifications_pm", "/wiadomosci", "_self", null, unreadNotifications.entries); } } navigation.addEventListener('navigate', (event) => { runWithDelay(countNumberOfNotificationsOnDesktop, 1000)}); let user = null; window.onload = function(event) { user = $('body > section > aside').data('user'); // console.log(user); runWithDelay(countNumberOfNotificationsOnDesktop, 1000) addNotificationSummaryButtonToNavBar(); addWykopXButtonsToNavBar(); createNewProfileDropdownMenuItem("Wykop X - Informacje", "Otwórz stronę Wiki z informacjami o dodatku Wykop X", "wykopx_wiki", "http://wiki.wykopx.pl/", "_blank", null, null) unrollDropdowns(); focusOnAddingNewMicroblogEntry(); addExtraButtons(); addWykopXPromo(); hideWykopXSPromo(); categoryRedirectToMicroblogButton(); }; const promoString = "[Przycisk dodany przez Wykop X #wykopwnowymstylu]"; function addWykopXButtonsToNavBar() { let $clone = $(`body header nav ul li:not(.active):not(:has(a[href="/wykopalisko"])):first`).clone(); let $cloneHits = $clone.clone(); let $cloneMyWykop = $clone.clone(); let $cloneAddNewEntry = $clone.clone(); let $cloneAddNewLink = $clone.clone(); let $cloneWykopWNowymStylu = $clone.clone(); let $cloneInstallWykopX = $clone.clone(); $cloneMyWykop.attr({class: "wykopxs wykopx_mywykop_li"}).find("a").attr({ href: "/obserwowane", class: "wykopxs wykopx_mywykop_button", title: `Mój Wykop ${ promoString }`}).find("span").text("Mój Wykop"); $cloneHits.attr({class: "wykopxs wykopx_hits_li"}).css("display","none").find("a").attr({href: "/hity", class: "wykopxs wykopx_hits_button", title: `Hity ${ promoString }`}).find("span").text("Hity"); $cloneAddNewLink.attr({class: "wykopxs wykopx_add_new_link_li wykopx_plus_li"}).css("display","none").find("a").attr({href: "/dodaj-link", class: "wykopxs wykopx_add_new_link wykopx_plus_button", title: `Dodaj nowe Znalezisko ${ promoString }`}).find("span").text("+"); $cloneAddNewEntry.attr({class: "wykopxs wykopx_add_new_entry_li wykopx_plus_li"}).css("display","none").find("a").attr({href: "/mikroblog/#dodaj", class: "wykopxs wykopx_add_new_entry wykopx_plus_button", title: `Dodaj nowy wpis na Mirko ${ promoString }`}).find("span").text("+"); $cloneInstallWykopX.attr({class: "wykopx-promo wykopx_install_wykopx_li"}).find("a").attr({href: "https://bit.ly/wykopx_install_wykopx_button", target: "_blank", class: "wykopx-promo wykopx_install_wykopx_button", title: `Zainstaluj style CSS "𝗪𝘆𝗸𝗼𝗽 𝗫" w rozszerzeniu Stylus i odkryj dziesiątki dodatkowych funkcji Wykopu. Masz już zainstalowane rozszerzenie `}).find("span").text("Zainstaluj Wykop X"); $cloneHits.insertAfter(`body header nav.main ul li:has(a[href="/wykopalisko"])`); $cloneAddNewLink.insertAfter(`body header nav.main ul li:has(a[href="/wykopalisko"])`); $cloneAddNewEntry.insertAfter(`body header nav.main ul li:has(a[href="/mikroblog"])`); $cloneMyWykop.appendTo(`body header nav.main ul`); $cloneInstallWykopX.appendTo(`body header nav.main ul`); } function createNewProfileDropdownMenuItem(text, title, className, url, target="_blank", icon=null, number=null) { $(`body header div.right nav ul li.account.dropdown ul.dropdown-body li.${ className }_li`).remove(); let $clonedDropdownItem = $(`body header div.right nav ul li.account.dropdown ul.dropdown-body li.settings`).clone(); $clonedDropdownItem.attr({class: `${ className }_li`}) $clonedDropdownItem.find("a").attr({href: url, target: target, class: "`${ className }_button`", title: title}).text(text); $clonedDropdownItem.appendTo(`body header div.right nav ul li.account.dropdown ul.dropdown-body`); } function addNotificationSummaryButtonToNavBar() { let mojeLubTagi = $("header .right ul li.account.dropdown ul.dropdown-body li.notifications.new a").attr("href"); let wykopx_notification_summary_url = "/powiadomienia/"; if(typeof mojeLubTagi == "string") { mojeLubTagi = mojeLubTagi.split("/").pop(); if(mojeLubTagi == "tagi") { createNewProfileDropdownMenuItem(`Powiadomienia z #tagów`, "Masz nowe powiadomienia z obserwowanych #tagów", "wykopx_notifications_tags", "/powiadomienia/tagi", "_self", null, null); } if(mojeLubTagi == "moje") { createNewProfileDropdownMenuItem(`Powiadomienia z #tagów`, "Masz nowe powiadomienia z obserwowanych #tagów", "wykopx_notifications_tags", "/powiadomienia/tagi", "_self", null, null); createNewProfileDropdownMenuItem(`Zawołania w komentarzach`, "Zawołano Cię w komentarzu", "wykopx_notifications_entries", "/powiadomienia/moje", "_self", null, null); } wykopx_notification_summary_url += mojeLubTagi; } let wykopx_notification_summary = `<li class="wykopxs wykopx_notification_summary notifications dropdown" title="Nowe powiadomienia ${ promoString }"><a href="${ wykopx_notification_summary_url }"><figure></figure></a></li>`; $(wykopx_notification_summary).prependTo(`header.header > .right > nav > ul`); } function addExtraButtons() { let wykopx_mywykop_mobile_li = `<li class="wykopxs wykopx_mywykop_mobile_li"><a href="/obserwowane" class="wykopx_mywykop_mobile_button" title="Mój Wykop ${ promoString }"><figure></figure></a></li>`; $(wykopx_mywykop_mobile_li).appendTo(`header.header > .right > nav > ul`); /* dolna belka mobilna */ $(wykopx_mywykop_mobile_li).appendTo(`body section.default-layout nav.mobile-navbar > ul`); let wykopx_microblog_mobile_li = `<li class="wykopxs wykopx_microblog_mobile_li"><a href="/mikroblog" class="wykopx_microblog_mobile_button" title="Mikroblog ${ promoString }"><figure> </figure></a></li>`; $(wykopx_microblog_mobile_li).appendTo(`header.header > .right > nav > ul`); let wykopx_wykopwnowymstylu_li = `<li class="wykopxs wykopx_wykopwnowymstylu_li"><a href="/tag/wykopwnowymstylu" class="wykopx_wykopwnowymstylu_button" title="Przejdź na #wykopwnowymstylu"><span>#</span></a></li>`; $(wykopx_wykopwnowymstylu_li).appendTo(`header.header > .right > nav > ul`); let wykopx_messages_mobile_li = `<li class="wykopxs wykopx_messages_mobile_li"><a href="/wiadomosci" class="wykopx wykopx_messages_button" title="Wiadomości ${ promoString }"><figure></figure></a></li>`; /* dolna belka mobilna */ $(wykopx_messages_mobile_li).appendTo(`body section.default-layout nav.mobile-navbar > ul`); if (user !== null) { let wykopx_profile_mobile_li = `<li class="wykopxs wykopx_profile_mobile_li ${ user.username }"><a href="/ludzie/${ user.username }" class="wykopx wykopx_profile_button" title="Przejdź na swój profil ${ user.username } ${ promoString }"><figure></figure></a></li>`; $(wykopx_profile_mobile_li).appendTo(`body section.default-layout nav.mobile-navbar > ul`); } } function focusOnAddingNewMicroblogEntry() { let hash = new URL(document.URL).hash; if(hash == "#dodaj") { document.querySelector(`section.microblog-page section.microblog section.editor div.content textarea`).focus(); } } // waitForKeyElements("section.stream div.content section.entry div.comments section.entry-subcomments div.content section.reply", sortCommentsByID); // document.removeEventListener('click', this.documentClick) function unrollDropdowns(dropdown) { //console.log(dropdown) document.removeEventListener('click', this.documentClick) } /* function sortCommentsByID(comment) { let commentID = comment.attr ("id").substr(8, 9); console.log(commentID); comment.css("order", commentID); } */ /* browarek programisto piekielny, przestań mi kurka kod prześladować! */ waitForKeyElements(".inline-autocomplete-stream", newAutoCompleteWindowAdded); const tagsAutocompleteURL = "https://wykop.pl/api/v3/tags/" const profilesAutocompleteURL = "https://wykop.pl/api/v3/profile/users/" function newAutoCompleteWindowAdded(element) { let suggestions = element[0].getElementsByTagName('span'); if (typeof this.lastFingerPrint == "undefined" || this.lastCount != suggestions.length || this.lastFingerPrint != getTagsFingerPrint(suggestions)) { for (let i = 0; i < suggestions.length; i++) { let suggestion = suggestions[i]; getObserveCount(suggestion); } } this.lastFingerPrint = getTagsFingerPrint(suggestions); this.lastCount = suggestions.length return true; } function getTagsFingerPrint(suggestions) { let fingerPrint = ''; for (let i = 0; i < suggestions.length; i++) { let suggestion = suggestions[i]; fingerPrint += suggestion.innerText.substring(1,).split(' ')[0]; } return fingerPrint; } function getObserveCount(element) { var type = element.innerText.substring(0,1); var query = element.innerText.substring(1,); var xmlhttp = new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { var details = JSON.parse(this.responseText); addCount(type, element, details.data) } }; xmlhttp.open("GET", (type === '@' ? profilesAutocompleteURL : tagsAutocompleteURL) + query); xmlhttp.setRequestHeader("Authorization", "Bearer " + window.localStorage.token) xmlhttp.send(); } function addCount(prefix, element, data) { const name = (prefix === '@' ? data.username : data.name) const followers = (prefix === '@' ? data.summary.followers : data.followers) if(prefix != '@') { $(element) .parent() .attr({style: `order: ${ followers }`, "data-followers":`${ followers }`}) .html(`<div class="wykopxs wykopx_autocomplete_element wykopx_autocomplete_tag"> <div class="wykopx_autocomplete_prefix">${ prefix }</div> <div class="wykopx_autocomplete_name">${ name }</div> <div class="wykopx_followers_counter">${ followers }</div> <meter class="wykopx_followers_meter" min="0" max="1000" low="99" high="500" optimum="999" value="${ followers }"></meter>`); } }
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址