Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ==UserScript==
- // @name ILoveRadioBot
- // @namespace http://tampermonkey.net/
- // @version 0.1
- // @description try to take over the world!
- // @author Bluscream
- // @updateurl https://gist.github.com/Bluscream/d0f3bf4f4e380e528cb60f51aafc28c7/raw/1269e890147dc1885f34da8e813cd803328b7974/iloveradio.user.js
- // @match http://www.iloveradio.de/*
- // @grant none
- // ==/UserScript==
- var interval;
- (function() {
- 'use strict';
- var sendMessage = function(msg){ ilr3.shoutbox.send(msg);};
- var sayMessage = function(name, msg){ sendMessage(name+': '+msg);};
- var ilr = {
- name: 'BluBoot',
- admins: ['Bluscream', 'Angi'],
- prefix: '!',
- welcomes: ['hi', 'hey', 'hallo', 'jo', 'hallöchen'],
- byes: ['bye', 'tschüss', 'tschau', 'ciao'],
- users: [],
- blacklist: [],
- commands: {
- 'help': 'var coms = "";'+
- 'for (var key in ilr.commands) {'+
- 'if (!ilr.commands.hasOwnProperty(key)){continue;}'+
- 'if (ilr.admincommands.hasOwnProperty(key)){continue;}'+
- 'coms = coms + ilr.prefix +key+" ";'+
- '}'+
- 'ilr3.shoutbox.send('+
- '"Commands: "+coms);',
- 'boot': 'ilr3.shoutbox.send("gist[DOT]github[DOT]com/Bluscream/d0f3bf4f4e380e528cb60f51aafc28c7");',
- 'playing': 'var _radio = $(".channel-headline.big").text();'+
- 'var _artist = $(".channelinfo>.artist").text().toTitleCase();'+
- 'var _title = $(".channelinfo>.title").text().toTitleCase();'+
- 'ilr3.shoutbox.send(_radio+" is playing \'"+_title+"\' by \'"+_artist+"\'.");',
- 'time': 'var _now = new Date();ilr3.shoutbox.send(_now.toString());',
- 'last': 'ilr3.shoutbox.send("UPPER: \'"+lastMessage.name.toUpperCase()+"\' lower: \'"+lastMessage.name.toLowerCase()+"\'");',
- 'love': 'switch(args.length){'+
- 'case 1:'+
- 'ilr3.shoutbox.send(msg.name+" ♥ "+args[0]);break;'+
- 'case 2:'+
- 'ilr3.shoutbox.send(args[0]+" ♥ "+args[1]);break;'+
- '};',
- 'credits': 'ilr3.shoutbox.send("Thanks to Angi, FaridBang and Rooz.");',
- 'info': 'ilr3.shoutbox.send("Boot written as ECMS Java Userscrlpt by Bluscream with ♥");',
- 'calc': 'if(args.length == 3){var result = 0;switch(args[1]){'+
- 'case "+": result = Number(args[0]) + Number(args[2]);break;'+
- 'case "-": result = Number(args[0]) - Number(args[2]);break;'+
- 'case "*": result = args[0] * args[2];break;'+
- 'case "/": args[1] = "/";result = args[0] / args[2];break;'+
- '};'+
- 'sayMessage(msg.name, args[0]+" "+args[1]+" "+args[2]+" = "+result)};',
- 'uinfo': 'var _user = args.toString().replaceAll(","," ");'+
- 'var _name = "unknown";var _id = "unknown";'+
- 'var _users = ilr.users;'+
- 'var _length = _users.length;'+
- 'for (var i = 0; i < _length; i++) {'+
- 'if(_users[i] == _user){'+
- 'sendMessage("ID: "+i+" Name: \'"+_users[i]+"\' lower: \'"+_users[i].toLowerCase()+"\' UPPER: \'"+_users[i].toUpperCase()+"\'");break;'+
- '}'+
- '};',
- 'uid': 'console.info(ilr.getUserByID(Number(args[0])));',
- 'ulist': 'sendMessage(ilr.users.toString());',
- 'ulength': 'sendMessage("User Database contains "+ilr.users.length.toString()+" users.");',
- 'angi': 'sendMessage("♥ Angi isch kuhl oke ♥");',
- 'jessi': 'sendMessage("♥ Jessi is love, Jessi is life! ♥");',
- 'contact': 'sendMessage("Steam/Github: Bluscream");',
- },
- admincommands: {
- 'blist': 'ilr3.shoutbox.send("Blacklisted Users: "+ilr.blacklist.toString());',
- 'blacklist': 'ilr.blacklist.push(args.toString().replaceAll(","," "));saveSettings("blacklist", ilr.blacklist);ilr3.shoutbox.send(args.toString().replaceAll(","," ")+" was blacklisted by "+msg.name+".");',
- 'unblacklist': 'ilr.blacklist.splice(ilr.blacklist.indexOf(args.toString().replaceAll(","," ")), 1);saveSettings("blacklist", ilr.blacklist);ilr.blacklist.push(msg.name);ilr3.shoutbox.send(args.toString().replaceAll(","," ")+" was un-blacklisted by "+msg.name+".");',
- 'repeat': 'if(args.length > 1){var _delay = Number(args[0])*1000;var _args = args; _args.shift();interval = setInterval(function(){ilr3.shoutbox.send(_args.toString().replaceAll(","," "));}, _delay)};',
- 'srepeat': 'clearInterval(interval);',
- 'eval': 'eval(args.toString().replaceAll(","," "));ilr3.shoutbox.send(" Executed: "+args.toString().replaceAll(","," "));',
- 'say': 'ilr3.shoutbox.send(msg.name+" says \\""+args.toString().replaceAll(","," ")+"\\".");',
- 'restart': 'ilr3.shoutbox.send("Boot is restarting...");window.location.reload();',
- 'ban': 'ilr3.shoutbox.send(args.toString().replaceAll(","," ")+" was banned by "+msg.name+".");',
- 'mute': 'ilr3.shoutbox.send(args.toString().replaceAll(","," ")+" was muted by "+msg.name+".");',
- },
- getUserByName: function(name){
- $.each(ilr.users, function(i,e){
- if(e == name){return {'id': i, 'name': e, 'lower': e.toLowerCase(), 'upper': e.toUpperCase()};}
- }
- );},
- getUserByID: function(id){
- $.each(ilr.users, function(i,e){
- if(i == id){return {'id': i, 'name': e, 'lower': e.toLowerCase(), 'upper': e.toUpperCase()};}
- }
- );}
- };
- ilr.welcome = 'logged in. Use '+ilr.prefix+'help to get a list of Commands.';
- // 'String'.capitalizeFirstLetter();
- String.prototype.capitalizeFirstLetter = function() {
- return this.charAt(0).toUpperCase() + this.slice(1);
- };
- // 'String'.toTitleCase();
- String.prototype.toTitleCase = function() {
- return this.replace(/\w\S*/g, function(txt){return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();});
- };
- // 'String'.contains(str);
- String.prototype.contains = function(str) {
- return this.indexOf(str) != -1;
- };
- // 'String'.replaceAll(search, replacement);
- String.prototype.replaceAll = function(search, replacement) {
- return this.split(search).join(replacement);
- };
- // isEmpty(s);
- var isEmpty = function(s) {
- if( !s || (typeof s === "undefined") || (typeof s === null) || (s == "null") || (s == "undefined") || (s == "empty") || (s == "NaN") || (s == "-1")){
- return true;
- }else{
- return false;
- }
- };
- // loadSettings(name, default, base64);
- var loadSettings = function(name, settings, base64){
- if(base64){
- if (isEmpty(localStorage.getItem(name))){ localStorage.setItem(name, btoa(JSON.stringify(settings))); }
- name = window.localStorage[name];return JSON.parse(atob(name));
- }else{
- if (isEmpty(localStorage.getItem(name))){ localStorage.setItem(name, JSON.stringify(settings)); }
- return JSON.parse(localStorage.getItem(name));
- }
- };
- // saveSettings(name, settings, base64);
- var saveSettings = function(name, settings, base64){
- if(base64){
- localStorage.setItem(name, btoa(JSON.stringify(settings)));
- }else{
- localStorage.setItem(name,JSON.stringify(settings));
- }
- };
- ilr.blacklist = loadSettings("blacklist", ilr.blacklist);
- var lastMessage = "";
- setTimeout(function(){
- $('#playstop').click();
- localStorage.removeItem('ilr_uid');
- ilr3.log = function(){};
- $('#ilr_shoutbox .chat .msg').unbind('keyup').bind('keyup', function(e) {
- if (e.keyCode === 13) {
- ilr3.shoutbox.send($('#ilr_shoutbox .chat .msg').val());
- $('#ilr_shoutbox .chat .msg').val('');
- }
- });
- ilr3.shoutbox.get = function(msg) {
- console.log(msg);
- msg.name = decodeURI(msg.name);
- msg.text = decodeURI(msg.text);
- var text = msg.text;
- var _text = text.toLowerCase();
- var _users = ilr.users;
- if(msg.name == ilr.name){
- if(typeof msg.verified === 'undefined'){
- msg.verified = true;
- }
- }
- if (('undefined' !== typeof msg.verified)) {
- $('#ilr_shoutbox .chat .textarea').append('<div><span class="name">' + msg.name + ((msg.verified === true) ? '<span class="verified"></span>' : '') + '</span>' + msg.text + '</div>');
- } else {
- $('#ilr_shoutbox .chat .textarea').append('<div><span class="name">' + msg.name + '</span>' + msg.text + '</div>');
- }
- while ($('#ilr_shoutbox .chat .textarea div').length > 50) {
- $('#ilr_shoutbox .chat .textarea div:first').remove();
- }
- if ($('#ilr_shoutbox .chat .textarea').length > 0) {
- $('#ilr_shoutbox .chat .textarea').scrollTop($('#ilr_shoutbox .chat .textarea')[0].scrollHeight);
- }
- if(msg.name != ilr.name){
- //console.info($.inArray( _users, msg.name ));
- if($.inArray( msg.name, _users ) == -1){
- if(msg.name.contains('I')){
- $.each(ilr.users, function(i,e){
- if(e == msg.name.replaceAll('I', 'l') && msg.name != e){
- ilr3.shoutbox.send('\''+msg.name.toLowerCase()+'\'s name contains a uppercase "i", he\'s probably faking '+msg.name.replaceAll('I', 'l')+'.');return;
- }
- });
- }else{
- var _length = ilr.welcomes.length;
- for (var i = 0; i < _length; i++) {
- if(_text.contains(ilr.welcomes[i])){
- ilr3.shoutbox.send('Hey '+msg.name+' ♥');
- }
- }
- }
- _users.push(msg.name);
- }
- //$.each( ilr.byes, function(i,e){
- //if(_text.contains(e)){
- //ilr3.shoutbox.send('Bye '+msg.name+' ☻');
- //}
- //});
- // console.log(ilr.users);
- }
- if(_text.startsWith(ilr.prefix)){
- if($.inArray(msg.name, ilr.blacklist) != -1){return;};
- var _txt = text.split(ilr.prefix)[1];
- var args = _txt.split(' ') || '';
- var cmd = args.shift();
- for (var key in ilr.commands) {
- if (!ilr.commands.hasOwnProperty(key)) continue;
- var command = key.toLowerCase();
- var action = ilr.commands[key];
- if(cmd == command){
- console.info('Command \''+cmd+'\' with arguments \''+args+'\' was issued by '+msg.name+'.');
- try{
- if(msg.name == ilr.name){
- setTimeout(function(){eval(action);}, 1000);break;
- }else{
- eval(action);break;
- }
- }catch(e){
- sayMessage(msg.name, '\''+command+'\' '+e);
- console.error('Bot is unable to process command '+command+'\n\n.Error Message: '+e+'\n\nAction:\n\n'+action);break;
- }
- }
- }
- for (var key in ilr.admincommands) {
- if (!ilr.admincommands.hasOwnProperty(key)) continue;
- var command = key.toLowerCase();
- var action = ilr.admincommands[key];
- if(cmd == command){
- console.info('AdminCommand \''+cmd+'\' with arguments \''+args+'\' was issued by '+msg.name+'.');
- if($.inArray( msg.name, ilr.admins ) != -1){
- try{
- if(msg.name == ilr.name){
- setTimeout(function(){eval(action);}, 1000);break;
- }else{
- eval(action);break;
- }
- }catch(e){
- sayMessage(msg.name, '\''+command+'\' '+e);
- console.error('Bot is unable to process command '+command+'\n\n.Error Message: '+e+'\n\nAction:\n\n'+action);break;
- }
- }else{
- sayMessage(msg.name, 'You don\'t have the required permissions to use "'+command+'".');break;
- }
- }
- }
- };
- lastMessage = msg;
- };
- $('.login').find('input[type="text"]').val(ilr.name);
- $('.usr_submit').click();
- var _t = false;
- $('.message').each( function(i,e){
- if(e.text() == ilr.welcome)
- var _t = true;return;
- });
- if(!_t){ilr3.shoutbox.send(ilr.welcome);}
- ilr.users.push(ilr.name);
- for (var key in ilr.commands) {
- if (!ilr.commands.hasOwnProperty(key)) continue;
- console.info('Loaded command: '+key+' with action: '+ilr.commands[key]);
- }
- for (var key in ilr.admincommands) {
- if (!ilr.admincommands.hasOwnProperty(key)) continue;
- console.info('Loaded command: '+key+' with action: '+ilr.admincommands[key]);
- }
- //$('*').not('html,body,head,head *,.channel-headline.big,.single-outer.channelbgcolor,script,.flex-outer-allsize.fixed-outer-single-height,.flex-outer-allsize.fixed-outer-single-height *').remove();
- $('#bg,#menue,#channelpreview,#player,p[class="channel-headline"],.channelcover,#channeltoolbox,.social,div[href*="voting"],div[href*="voicemail"],.white'+
- '.single-outer.pointer,div[href="the-battle/"],div[href="rooz-radio-ueberdimensionales-radio-mit-rooz-lee/"],.contactbox,#footer').remove();
- $('.playlist').parent().remove();
- $('.big:contains(Playlist)').remove();
- $('.single-outer').hide();
- $('.flex-outer-allsize.fixed-outer-single-height').css('height', '500px');
- $('#ilr_shoutbox .chat .hidden-scrollbar,#ilr_shoutbox .textarea').css('height', '100%');
- $('.channelbgcolor').css('background-color', 'black').find('*').css('color', 'white');
- console.clear();
- },3000);
- })();
Add Comment
Please, Sign In to add comment