Witam.
Robię "badanie rynku".
PS: Jeżeli zabrakło Ci opcji (max. 5 do wybrania) w ankiecie, to napisz komentarz.
Bencbrnc687 pisze:
// ==UserScript==
// @name SU Viewership Changes
// @author fapka
// @namespace [email protected]
// @description
// @include https://showup.tv/
// @include https://showup.tv/?*
// @version 0.2
// @run-at document-end
// @grant GM_getValue
// @grant GM_setValue
// @noframes
// ==/UserScript==
/* globals jQuery, $ */
console.info && console.info('%c «%s» %c—— %c %s && to ignore: ',
'background:#000000; color:#7ebe45', GM_info.script.name,
'background:#000000; color:dimgray',
'background:#3c424d; color:#ffffff', GM_info.script.version);
function heartbeat(mode) { //serce skryptu :) czyli cykl chowania...
var trans_counter = $('body > div.container.page__home > div.row.pageheader > div.large-6.columns.large-text-right > h4'); //Div z licznikiem transmisji, tj. 82 transmisji i 4326 oglądających
var matches = trans_counter.text().match(/(\d[\d\.]*)/g); //Znajdź liczby w tekście...
var newT = Number(matches[0]); //transmisji... 82
var newV = Number(matches[1]); //widzów 4326
var oldT = GM_getValue("transmissions", newT)
var oldV = GM_getValue("viewership", newV);
var diffT = newT-oldT;
var diffV = newV-oldV;
var diffTColor = "white", diffVColor = "white", dTsign = "", dVsign = "";
if ( diffT < 0 ) { diffTColor = "red"; dTsign = ""; } //Minus jest zbędny, bo liczba jest ujemna
else if ( diffT > 0 ) { diffTColor = "green"; dTsign = "+"; }
if ( diffV < 0 ) { diffVColor = "red"; dVsign = ""; }
else if ( diffV > 0 ) { diffVColor = "green"; dVsign = "+"; }
var con_stats = [newT, newV];
//var newtext = con_stats[0]+" transmisji i "+con_stats[1]+" oglądających, w tym "+hiddenCount+" ukrytych (z "+initStreamCount+")"; //Podlicza ile schowano ludzi...
//trans_counter.text(newtext);
var oldContent = document.querySelector('body > div.container.page__home > div.row.pageheader > div.large-6.columns.large-text-right > h4').outerHTML
var newContent = "<h4 style='white-space:pre'>"; //Pozwala zachować białe znaki
//kolejność kontentu odwrócona, bo float right...
newContent += "<div style='float:right;'>oglądających</div>";
newContent += "<div style='float:right; color: "+diffVColor+"'> ("+dVsign+diffV+") </div>";
newContent += "<div style='float:right;'> i "+newV+"</div>";
newContent += "<div style='float:right;'>transmisji</div>";
newContent += "<div style='float:right; color: "+diffTColor+"'> ("+dTsign+diffT+") </div>";
newContent += "<div style='float:right;'>"+newT+"</div>";
newContent += "</h4>";
console.log(newContent);
document.querySelector('body > div.container.page__home > div.row.pageheader > div.large-6.columns.large-text-right > h4').outerHTML = newContent;
GM_setValue("transmissions", newT);
GM_setValue("viewership", newV);
}
heartbeat();
//trigger function on the load of transmissions...
(function(open) {
XMLHttpRequest.prototype.open = function(method, url, async, user, pass) {
this.addEventListener('readystatechange', function(event) {
if ( this.readyState === 4 &&
(
this.responseURL === 'https://showup.tv/site/get_stream_list/big' || // this.responseURL === 'https://showup.tv/site/trans_list/get_list/big')
this.responseURL === 'https://showup.tv/site/get_stream_list/bottom' //this.responseURL === 'https://showup.tv/site/trans_list/get_list/bottom' ||
)
)
setTimeout(heartbeat, 0); //Zapewnia działanie filtrów i chowania przy wczytaniu się (odświeżeniu) listy transmisji...
}, false);
return open.apply(this, arguments);
};
})(XMLHttpRequest.prototype.open);
Użytkownicy przeglądający to forum: Obecnie na forum nie ma żadnego zarejestrowanego użytkownika i 1 gość