Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name TorilPow
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description shows how to use babel compiler
- // @author You
- // @require https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.18.2/babel.js
- // @require https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.16.0/polyfill.js
- // @require http://code.jquery.com/jquery-3.4.1.min.js
- // @match https://toril.pl/*
- // ==/UserScript==
- const soundurl = 'http://www.chiptape.com/chiptape/sounds/medium/countdown.wav';
- // We are logged in if we have topbar.
- function getstatus(wit){
- let wits = [];
- if(wit.length){
- // alert('We have top bar!');
- for(let i=0;i<wit.length;i++){
- //console.log($(wit[i]).attr('style') + ' ' + $(wit[i]).attr('class'));
- if($(wit[i]).hasClass('wit1')){
- wits[0] = ($(wit[i]).attr('style').indexOf('wit2.png') == -1) ? 0: 1;
- }
- else if ($(wit[i]).hasClass('wit2')){
- wits[1] = ($(wit[i]).attr('style').indexOf('wit4.png') == -1) ? 0: 1;
- }
- else if ($(wit[i]).hasClass('wit3')){
- wits[2] = ($(wit[i]).attr('style').indexOf('wit8.png') == -1) ? 0: 1;
- }
- else if ($(wit[i]).hasClass('wit4')){
- wits[3] = ($(wit[i]).attr('style').indexOf('wit6.png') == -1) ? 0: 1;
- }
- }
- }
- return wits;
- }
- var player = document.createElement('audio');
- player.src = soundurl;
- player.preload = 'auto';
- $('body').append('<div id="informacjalewy" style="background-color: #22bb11; position: fixed; color: #000000; line-height: 50px;' +
- 'top:0px; left:0px; z-index=99; width:150px; height: 50px; text-align: center; valign: middle; display: none;">Nowe!</div>');
- function getajaxstatus(){
- $.ajax ( {
- type: 'GET',
- url: 'https://toril.pl/kp.php',
- success: function(data) {
- var doc = document.documentElement.cloneNode();
- doc.innerHTML = data;
- let newwit = $(doc.querySelectorAll('div.wit'));
- let sitewit = $('div.wit');
- let curwits = getstatus(sitewit);
- let newwits = getstatus(newwit);
- for(let i=0;i<curwits.length;i++){
- if(curwits[i] === 0 && newwits[i] === 1){
- $('div#informacjalewy').show();
- document.title = 'NOWY POST NA TELENOWERILU ONEELEVEN!';
- player.play();
- }
- }
- }
- });
- }
- getajaxstatus();
- var intid = setInterval(getajaxstatus, 30000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement