Otwiera opinie/oceny znajomych w nowym osobnym okienku zamiast nadpisywać stronę filmu.
当前为
// ==UserScript==
// @name Filmweb Community Rating Redirector
// @namespace https://gf.qytechs.cn/pl/users/636724-cml99
// @match http*://*filmweb.pl/film/*
// @match http*://*filmweb.pl/serial/*
// @match http*://*filmweb.pl/videogame/*
// @version 1.0.0
// @author CML99
// @license CC-BY-NC-SA-4.0
// @description Otwiera opinie/oceny znajomych w nowym osobnym okienku zamiast nadpisywać stronę filmu.
// @description:en Opens user opinions and friend ratings in a new separate window instead of replacing the current movie page.
// @icon https://www.google.com/s2/favicons?sz=64&domain=filmweb.pl
// @grant GM_xmlhttpRequest
// @grant GM.xmlHttpRequest
// @grant GM_addStyle
// ==/UserScript==
/* new tab links fallback */
var opinions = document.getElementsByClassName('opinionBoxNew__commentLink');
for (var i = 0; i < opinions.length; i++) {
opinions[i].setAttribute('target', '_blank');
}
/* opinions + critics */
function openInPopup(url) {
const features = 'width=800,height=600,resizable=yes,scrollbars=yes';
window.open(url, '_blank', features);
}
document.querySelectorAll('.opinionsSection .opinionBoxNew__commentLink').forEach(function (link) {
link.addEventListener('click', function (event) {
event.preventDefault();
openInPopup(this.href);
});
});
document.querySelectorAll('a[href$="/opinie#/critics"]').forEach(function (link) {
link.addEventListener('click', function (event) {
event.preventDefault();
openInPopup(this.href);
});
});
/* friend/critic votes */
function friendVoteAction (friendVoteEvent) {
const urlSplit = window.location.pathname.split('/').filter(segment => segment);
let urlType = urlSplit[0];
let urlTitle = urlSplit[1];
let friendVoteUrl = 'https://www.filmweb.pl/' + urlType +'/' + urlTitle + '/opinie#/friends/votes';
openInPopup(friendVoteUrl);
}
function criticVoteAction (criticVoteEvent) {
const urlSplit = window.location.pathname.split('/').filter(segment => segment);
let urlType = urlSplit[0];
let urlTitle = urlSplit[1];
let criticVoteUrl = 'https://www.filmweb.pl/' + urlType +'/' + urlTitle + '/opinie#/critics';
openInPopup(criticVoteUrl);
}
var intvFriend = setInterval(function() {
var filmRatingFriend = document.querySelector('.ratingStatsFilmFriendsVotes');
if (filmRatingFriend.length < 1) {
return false;
}
clearInterval(intvFriend);
document.querySelector(".ratingStatsFilmFriendsVotes").addEventListener("click", friendVoteAction, false);
}, 1000);
var intvCritic = setInterval(function() {
var filmRatingCritic = document.querySelector('.ratingStatsFilmCriticsVotes');
if (filmRatingCritic.length < 1) {
return false;
}
clearInterval(intvCritic);
document.querySelector(".ratingStatsFilmCriticsVotes").addEventListener("click", criticVoteAction, false);
}, 1000);
GM_addStyle ( `
.opinionBox__comment { pointer-events: none !important; } /* disable critic link */
.ratingStats.isCompact .ratingStats__content { pointer-events: none !important; } /* disable og votes link */
.ratingStatsFilmFriendsVotes:hover, .ratingStatsFilmCriticsVotes:hover { cursor: pointer; }
` );
QingJ © 2025
镜像随时可能失效,请加Q群300939539或关注我们的公众号极客氢云获取最新地址